如何让xdebug var_dump显示完整的对象/数组

本文翻译自:How to get xdebug var_dump to show full object/array

I am using xdebug (php_xdebug-2.1.2-5.3-vc9.dll) on WAMP . 我在WAMP上使用xdebug (php_xdebug-2.1.2-5.3-vc9.dll)。 When I use var_dump on a large object or variable it does not show the full variable. 当我在大对象或变量上使用var_dump ,它不会显示完整变量。

array
'node' => 
  array
    'my_form' => 
      array
        'form' => 
          array
            ...

Without xdebug it shows as should be expected. 没有xdebug它显示应该是预期的。 I looked at the documentation but did not see a solution. 我查看了文档,但没有看到解决方案。 Does anyone know how I can fix this so xdebug var_dump shows the full object? 有谁知道我怎么解决这个问题所以xdebug var_dump显示完整的对象?


#1楼

参考:https://stackoom.com/question/FX3Y/如何让xdebug-var-dump显示完整的对象-数组


#2楼

Or you can use an alternative: 或者您可以使用替代方案:

https://github.com/kint-php/kint https://github.com/kint-php/kint

It works with zero set up and has much more features than Xdebug's var_dump anyway. 它的设置为零,并且具有比Xdebug的var_dump更多的功能。 To bypass the nested limit on the fly with Kint, just use 要使用Kint动态绕过嵌套限制,只需使用

 +d( $variable ); // append `+` to the dump call

#3楼

I know this is a super old post, but I figured this may still be helpful. 我知道这是一个超级老帖子,但我认为这可能仍然有用。

If you're comfortable with reading json format you could replace your var_dump with: 如果您对阅读json格式感到满意,可以将var_dump替换为:

return json_encode($myvar);

I've been using this to help troubleshoot a service I've been building that has some deeply nested arrays. 我一直在使用它来帮助解决我正在构建的具有一些深度嵌套数组的服务。 This will return every level of your array without truncating anything or requiring you to change your php.ini file. 这将返回数组的每个级别,而不会截断任何内容或要求您更改php.ini文件。

Also, because the json_encoded data is a string it means you can write it to the error log easily 此外,因为json_encoded数据是一个字符串,这意味着您可以轻松地将其写入错误日志

error_log(json_encode($myvar));

It probably isn't the best choice for every situation, but it's a choice! 它可能不是每种情况的最佳选择,但它是一个选择!


#4楼

I now this is late but it might be of some use: 我现在这已经晚了但它可能有一些用处:

echo "<pre>";
print_r($array);
echo "</pre>";

#5楼

我想推荐var_export($array) - 它不显示类型,但它会生成您可以在代码中使用的语法:)


#6楼

Checkout Xdebbug's var_dump settings , particularly the values of these settings: 结帐Xdebbug的var_dump设置 ,尤其是这些设置的值:

xdebug.var_display_max_children
xdebug.var_display_max_data
xdebug.var_display_max_depth
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值