我配置成功,可以在 VSCode 上调试 PHP。
我的问题是,当我运行项目时,它总是在函数处出错:
protected function getJsonPayload($payload)
{
$payload = json_decode(base64_decode($payload), true);
// If the payload is not valid JSON or does not have the proper keys set we will
// assume it is invalid and bail out of the routine since we will not be able
// to decrypt the given value. We'll also check the MAC for this encryption.
if (! $this->validPayload($payload)) {
throw new DecryptException('The payload is invalid.');
}
if (! $this->validMac($payload)) {
throw new DecryptException('The MAC is invalid.');
}
return $payload;
}
... 来自文件:/srv/http/laravelproject/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php
我无法调试到设置的断点。
Gif画面记录:http://i.imgur.com/6pNkoHe.gif
最佳答案
在 Laravel 中使用 Docker 与 VsCode 和 xDebug 时遇到同样的问题。
对于任何对不同方法感兴趣的人(因为 Laravel 5.6 不再有 optimize
命令)
只需将 ignore
部分添加到您的 launch.json
配置中即可。
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/var/www/html": "${workspaceRoot}",
},
// add this
"ignore": [
"**/vendor/**/*.php"
]
},
为我解决了这个问题。
从Docker Github Repo得到这个
关于php - 无法在 Laravel 项目中使用 Visual Code 进行调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44669744/