Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logging console.log出现Firebug问题_Logging_Firebug - Fatal编程技术网

Logging console.log出现Firebug问题

Logging console.log出现Firebug问题,logging,firebug,Logging,Firebug,我的代码中有: console.log("hi there"); 在浏览器中运行时,会出现以下错误: 警告:日志要求参数1为双精度,字符串在中给出 /家/等 据我所知,我做得对 有人知道我为什么会出现这个错误吗?您的错误消息提示它来自PHP,而Firebug的控制台对象仅在JavaScript中可用,即在客户端。 因此,PHP代码中的console.log与getfirebug.com中描述的不同 您应该看看Firebug扩展,它允许您调试PHP应用程序。 你也应该通读这本书 Sebastia

我的代码中有:

console.log("hi there");
在浏览器中运行时,会出现以下错误:

警告:日志要求参数1为双精度,字符串在中给出 /家/等

据我所知,我做得对


有人知道我为什么会出现这个错误吗?

您的错误消息提示它来自PHP,而Firebug的控制台对象仅在JavaScript中可用,即在客户端。 因此,PHP代码中的console.log与getfirebug.com中描述的不同

您应该看看Firebug扩展,它允许您调试PHP应用程序。 你也应该通读这本书


Sebastian

您需要在代码中声明此新函数:

function console_log($output, $with_script_tags = true) 
{
    $js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) . ');';

    if ($with_script_tags) 
    {
        $js_code = '<script>' . $js_code . '</script>';
    }

    echo $js_code;
}

你操纵过控制台对象吗?或者加载了任何可能的插件?我不知道,但这是运行在WordPress安装内部的一堆插件,有没有什么方法可以找出它是否被操纵?alertconsole.log,看看它是否合适。它应该是关于本机代码的,我忘了说我是用PHP做的。我尝试了echo console.log;但那只是显示了康塞洛格,哈哈。
$myMessage = "hi there";
console_log($myMessage);