gpt4 book ai didi

php - 使用 PHP + XDEBUG 时在 VS Code 中显示长字符串

转载 作者:行者123 更新时间:2023-12-05 03:40:04 31 4
gpt4 key购买 nike

我正在使用 VS Code 进行 PHP 网络开发。带有 XDEBUG 的 VS Code 在显示字符串值变量方面似乎受到严重限制。 Variables 和 Watch 窗口受限于窗口的宽度或第一个换行符。

您可以通过评估字符串在调试控制台中显示更多内容,但最多只能显示略多于 1000 个字符的内容。该字符串只是被截断了。当您复制值并粘贴到编辑器窗口中时,也会发生同样的情况。

这在处理任何类型的现实生活中的 HTML 时都非常不合适。

我正在使用 VS Code 1.57.1​​ 和 XDEBUG 1.16.1(以及 PHP Intelephense 1.7.1)

有人知道调整这个的方法吗?

最佳答案

这里是答案:

Visual Studio Code debugging Array evaluation

基本上你需要在启动配置文件中添加一个max_data: -1

例如

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9004,
"xdebugSettings": {
"max_children": 128,
"max_data": -1,
"max_depth": 3
},
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9004,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
],
}

关于php - 使用 PHP + XDEBUG 时在 VS Code 中显示长字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68291170/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com