清理Vscode的缓存
C:\Users\Administrator\AppData\Roaming\Code
删除 Cache 和 CachedData
PHP Debug
settings.json
{
"php.validate.executablePath": "D:\\openresty-1.19.9.1-win64\\php\\php-8.1.4-nts-Win32-vs16-x64\\php.exe",
"workbench.colorTheme": "Default Light+",
"editor.fontSize": 16,
"intelephense.environment.includePaths": [
"../qgmvc/v1.0",
]
}
PHP.ini xdebug
[xdebug]
zend_extension = xdebug
xdebug.remote_enable=on
xdebug.remote_autostart=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.romote_host=localhost
xdebug.remote_port=9003
xdebug.idekey=vsc
xdebug.mode=debug
xdebug.start_with_request=yes
lauch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
},
{
"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": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]
}
名字空间
PHP Namespace Resolver
Ctrl + Alt + i 插入对象的 命名空间