Visual Studio Code 调试数组评估 [英] Visual Studio Code debugging Array evaluation

查看:41
本文介绍了Visual Studio Code 调试数组评估的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 Visual Studio Code 调试 PHP 时遇到了一个小问题.XDebug 工作正常,我能够在断点处停止并通过悬停在变量上或将它们添加到监视来评估变量.但是,当我尝试查看包含 32 个以上项目的数组时,我只能看到前 32 个.例如,包含 172 个项目的数组将仅显示 32 个项目.我试图以某种方式评估这个数组,在控制台或 json_encode 内运行转储命令,但无济于事.

I have a small issue when debugging PHP with Visual Studio Code. The XDebug works fine, I am able to stop at breakpoints and evaluate variables by hovering on them or adding them to watch. However when I attempt to view an array which has more than 32 items, I can only see those first 32. For example, an array of 172 items will only display 32 items. I tried to evaluate this array in a manner of ways, running dump commands inside the console, or json_encode, to no avail.

有什么想法吗?

推荐答案

感谢 Phiter 的评论,我设法找到了解决方案.

Thanks to Phiter's comment, I managed to find a fix.

本质上,XDebug 可以使用放置在文件 php.ini 中的各种选项进行配置.这些选项包括指定要在 GUI 上显示的对象的深度.

Essentially, XDebug can be configured with various options placed inside the file php.ini. Among these options are those which specify the depth of an object to display on the GUI.

但是,通过 Visual Code 的 PHP Debug (felixbecker.php-debug) 扩展进行调试时,必须在其他地方配置这些设置.此页面上列出了完整说明:https://github.com/felixfbecker/vscode-php-debug#supported-launchjson-settings其要点是打开左侧栏上的调试面板 -> 单击齿轮图标打开包含调试器设置的 launch.json 文件,然后 -> 添加以下代码片段:

However, when debugging through Visual Code's PHP Debug (felixbecker.php-debug) extension, these settings must be configured elsewhere. The full instructions are listed on this page: https://github.com/felixfbecker/vscode-php-debug#supported-launchjson-settings The gist of it is to open the Debug panel on the left bar -> click on the cogwheel icon to open the launch.json file which houses the debugger's settings, and -> add the following code snippet:

<代码> {"name": "侦听 XDebug","type": "php",请求":启动",端口":9000,xdebugSettings":{max_children":999,}},

就是这样.

这篇关于Visual Studio Code 调试数组评估的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆