我需要找出何时向浏览器的console.log发送警告(非错误)消息.通过研究,我知道我可以使用与此类似的JavaScript代码检测错误消息:
window.onerror = function(errorMsg, url, lineNumber){
// any action you want goes here
// errorMsg is the error message itself.
// url should be the file presenting the error, though i have
// found that it only presents to me the address of the site.
// lineNumber is the line number the error occoured on.
// here is an example of what you could do with it:
alert("Error in " + url + " at " + lineNumber + ":\n" …Run Code Online (Sandbox Code Playgroud) 环境:Host(JustHost)上测试站点上的Wordpress(最新),PHP版本5.4.43。
在URL查询上使用parse_str,结果数组返回数组键名amp; keyname。示例代码:
$querystring = "ie=UTF8&qid=1468851514&sr=8-1&keywords=there&tag=sitename-20";
parse_str($querystring, $queryarray);
echo "<pre>";
print_r($queryarray);
echo "</pre>";
Run Code Online (Sandbox Code Playgroud)
退货
Array
(
[ie] => UTF8
[amp;qid] => 1468851514
[amp;sr] => 8-1
[amp;keywords] => there
[amp;tag] => sitename-20
)
Run Code Online (Sandbox Code Playgroud)
为什么是“放大器;” 在键名中?
这是PHP版本的问题吗(在EasyPHP本地环境中似乎可以正常工作-版本5.4.24,但在托管位置的测试WP服务器上却没有)?还是我再次感到困惑?