启用xdebug时,Firebug中出现无法读取的var_dump [英] Unreadable var_dump in Firebug when xdebug is enabled
问题描述
Xdebug以自己的方式显示var_dump,更有用的信息,但在Firebug中是不可读的。
Xdebug displays "var_dump" in its own way with more useful information, but in Firebug is unreadable.
我想知道是否有方法显示var_dump在Firebug中,使其可读取,而不禁用xdebug,并且还保留在PHP中由xdebug创建的var_dump的显示。
I was wondering if there was a way to display the var_dump in Firebug to make it readable without disabling xdebug and also keeping the display of the var_dump made by xdebug in PHP.
Firebug中显示的var_dump示例:
Examples of var_dump displayed in Firebug:
$test = array('id' => '42', 'name' => 'Mao');
var_dump($test);
默认值:
array(2) {
["id"]=>
string(2) "42"
["name"]=>
string(3) "Mao"
}
Xdebug:
<pre class='xdebug-var-dump' dir='ltr'>
<b>array</b>
'id' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'42'</font> <i>(length=2)</i>
'name' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'Mao'</font> <i>(length=3)</i>
</pre>
推荐答案
您可以关闭Xdebug - var_dump()
通过将 xdebug.overload_var_dump
设置为 false
来进行重载。然后,当您不需要额外的HTML格式和 xdebug_var_dump()
时,您可以使用 var_dump()
需要一个完全格式化的调试输出。
You can switch off Xdebug-var_dump()
-overloading by setting xdebug.overload_var_dump
to false
. Then you can use var_dump()
when you don't need the additional HTML-formatting and xdebug_var_dump()
when you require a fully formatted debug output.
但是正如我在上面的评论中写道,如果你使用 FirePHP ,您可以简单地将FirePHP格式化为Firebug控制台中的输出:
But as I wrote in my comment above, if you're using FirePHP, you can simply let FirePHP format the output in your Firebug console:
fb($variable, FirePHP::DUMP) // or
FB::dump('Key', $variable) // or
$firephp->dump('Key', $variable); // where $firephp is your FirePHP instance
这篇关于启用xdebug时,Firebug中出现无法读取的var_dump的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!