xdebug: var_dump函数设置

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

   在安装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. NGINX 1.31.7: Native GeoIP2 support, HTTP/2 priorities, and QUIC improvements (2026-11-13 23:40:02)
  2. 说说广场 API 0.31.0 版的调用代码说明 (2026-11-13 19:10:02)
  3. NGINX Routing on HTTP Request Body (2026-10-27 14:10:42)

查看更多 后端 文章 →

建议继续学习

  1. Fix Bug的五个阶段 (累计阅读 43,262)
  2. 使用gettext来支持PHP的多语言 (累计阅读 39,700)
  3. WordPress插件开发 -- 在插件使用数据库存储数据 (累计阅读 29,566)
  4. Paypal接口详细代码(PHP版,非API接口) (累计阅读 19,818)
  5. 调试工具之GDB (累计阅读 15,171)
  6. 我的PHP,Python和Ruby之路 (累计阅读 13,718)
  7. include(“./file.php”)和include(“file.php”)区别 (累计阅读 13,270)
  8. 15个最好的免费开源电子商务平台 (累计阅读 12,947)
  9. Redis消息队列的若干实现方式 (累计阅读 12,535)
  10. 到底什么是MVC? (累计阅读 12,382)