Atitit vscode 调试php vscode使用法 目录 1. 直接debug没反应,或者打开扩展列表 1 2. 调试配置法 1 2.1. Debug》》Add cfg php 1 2.2.
Atitit vscode 调试php vscode使用法
目录
1. 直接debug没反应,或者打开扩展列表 1
2. 调试配置法 1
2.1. Debug》》Add cfg php 1
2.2. Xdebug 和直接执行调试 1
2.3. 增加runtimeExecutable 1
3. PHP extensions 2
4. 问题解决法 4
4.1. spawn php ENOENT" In VS Code 4
5. 格式化 5
6. 重构 5
6.1. 改变变量名 5
1.直接debug没反应,或者打开扩展列表
增加调试配置
2.调试配置法
2.1.Debug》》Add cfg php
2.2.Xdebug 和直接执行调试
选择: "Launch currently open script",
2.3.增加runtimeExecutable
Zengjia
"runtimeExecutable": "C:/wamp/bin/php/php5.6.31/php.exe",
Launch.json
3.PHP extensions
There are many PHP language extensions available on the VS Code Marketplace and more are being created. You can search for PHP extensions from within VS Code in the Extensions view (Ctrl+Shift+X) then filter the extensions drop-down list by typing 'php'.
Prettier - Code form...
4.4M
esbenp
Code formatter using prettier
Code Runner
2.9M
formulahendry
Run C, C++, Java, JS, PHP, Python, Perl, Ruby, Go...
PHP IntelliSense
2.9M
felixfbecker
Advanced Autocompletion and Refactoring support f...
HTML CSS Support
2.4M
ecmel
CSS support for HTML documents
Tip: The extensions shown above are dynamically queried. Click on an extension tile above to read the description and reviews to decide which extension is best for you. See more in the Marketplac
I found what's the problem. The extension uses the global PATH for php, and if you don't have php in the PATH you have to define it in the extension settings: "runtimeExecutable : my\path\php.exe"
4.问题解决法
4.1.spawn php ENOENT" In VS Code
Zengjia
"runtimeExecutable": "C:/wamp/bin/php/php5.6.31/php.exe",
Launch.json
{
// 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": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"runtimeExecutable": "C:/wamp/bin/php/php5.6.31/php.exe",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
5.格式化
Useing:: rignt key>>format
ile>Preferences>Settings
from the window that comes when u choose settings, you need to search for "Edit in settings.json" click on that and over there you need to specify your php.exe file path
mine looks like this
{
"phpfmt.php_bin": "\"C:\\Program Files\\php\\php.exe\"",
}
或者sarch phpfmt.php_bin。。Then type in path then ok...
6.重构
6.1.改变变量名
Rightkey 》》change al occurence