如何在VSCode中添加PHP可执行文件路径解决调试启动报错问题
VSCode settings.json添加PHP可执行路径配置方法
你可以将php.validate.executablePath配置项添加到settings.json的顶层任意位置,只要不嵌套在其他{}包裹的子配置块内即可,同时需要注意两点:
- 非末尾的键值对末尾需要加英文逗号分隔,避免JSON语法报错
- 你提供的路径
C:xampp/php/php.exe缺少C盘后的根路径标识,建议修正为C:/xampp/php/php.exe,用正斜杠也可以避免Windows路径转义问题
以下是修改后的完整配置示例,我把该项放在了[php]配置块下方方便后续管理:
{ "workbench.colorTheme": "Solarized Dark", "workbench.editorAssociations": { "*.ipynb": "jupyter-notebook" }, "editor.suggestSelection": "first", "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", "workbench.startupEditor": "none", "[php]": { "editor.defaultFormatter": "kokororin.vscode-phpfmt" }, "php.validate.executablePath": "C:/xampp/php/php.exe", "notebook.cellToolbarLocation": { "default": "right", "jupyter-notebook": "left" }, "editor.fontSize": 15, "editor.cursorBlinking": "smooth", "editor.cursorSmoothCaretAnimation": true, "editor.formatOnType": true, "auto-close-tag.fullMode": true, "auto-close-tag.insertSpaceBeforeSelfClosingTag": true, "auto-close-tag.SublimeText3Mode": true, "python.languageServer": "None", "html.format.templating": true }
保存后重启VSCode即可生效。
内容的提问来源于stack exchange,提问作者Gopipuli
相关产品推荐
相关产品推荐

