Mao*_*gue 14 php error-handling firefox firebug xdebug
Xdebug以自己的方式显示"var_dump",提供更多有用的信息,但在Firebug中是不可读的.
我想知道是否有一种方法可以在Firebug中显示var_dump,使其在不禁用xdebug的情况下可读,并且还可以在PHP中保持xdebug显示的var_dump.
Firebug中显示的var_dump示例:
$test = array('id' => '42', 'name' => 'Mao');
var_dump($test);
Run Code Online (Sandbox Code Playgroud)
默认值:
array(2) {
["id"]=>
string(2) "42"
["name"]=>
string(3) "Mao"
}
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
您可以var_dump()通过设置xdebug.overload_var_dump为关闭Xdebug- -overloading false.然后,var_dump()当您不需要额外的HTML格式以及xdebug_var_dump()需要完全格式化的调试输出时,您可以使用它.
但正如我在上面的评论中所写,如果你使用的是FirePHP,你可以简单地让FirePHP格式化Firebug控制台中的输出:
fb($variable, FirePHP::DUMP) // or
FB::dump('Key', $variable) // or
$firephp->dump('Key', $variable); // where $firephp is your FirePHP instance
Run Code Online (Sandbox Code Playgroud)