IT技术博客大学习 共学习 共进步

xdebug: var_dump函数设置

博客园-rethink log 2009-11-09 13:30:04 累计浏览 3,426 次

   在安装xdebug之后,php原来的var_dump方法会被改变,显示效果变得更加友好。

    http://xdebug.org/docs/display 上的说明:

    Xdebug replaces PHP\'s var_dump() function for displaying variables. Xdebug\'s version includes different colors for different types and places limits on the amount of array elements/object properties, maximum depth and string lengths. There are a few other functions dealing with variable display as well.

    虽然显示更加友好了,但是在默认的设置下,经常会使复杂的数组和对象不能完整的显示。反而不利于我们调试。此时,只要在程序中动态修改下面三个值就可以了:

    ini_set(\'xdebug.var_display_max_children\', 128 );//xdebug.var_display_max_children Type: integer, Default value: 128

    ini_set(\'xdebug.var_display_max_data\', 512 );//Type: integer, Default value: 512

    ini_set(\'xdebug.var_display_max_depth\', 3);//Type: integer, Default value: 3

    最后这个是指复杂的数组或对象显示时候的“深度”了。 

建议继续学习

  1. Xdebug使用指南 (累计阅读 4,266)
  2. Ubuntu 下为 PHP 添加 Xdebug 插件 (累计阅读 3,264)
  3. xdebug 配置,在这里备份下 (累计阅读 3,103)
  4. 前端开发中的性能那点事(一)巧用xdebug (累计阅读 2,945)
  5. 使用xdebug调试PHP 找出PHP程序的瓶颈 (累计阅读 2,946)