XDebug V3在单PHP文件可用但Laravel项目调试失效求助
XDebug V3在Laravel项目中无法触发断点(单文件调试正常)
已查阅《visual studio code PHP debugging not working》《XDebug not working in VScode for php debugging》等Stack Overflow帖子,仍无法让XDebug在Laravel项目中正常工作。使用VSCode和XDebug V3,调试单PHP文件时断点可正常触发,但Laravel项目中的断点毫无反应。
配置信息
Launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Listen for XDebug", "type": "php", "request": "launch", "port": 9000, "stopOnEntry": true, "log": true, }, { "name": "Launch currently open script", "type": "php", "request": "launch", "program": "${file}", "cwd": "${fileDirname}", "port": 9000, "pathMappings": { "C:/xampp/htdocs/myLaravelProject": "${workspaceFolder}" } } ] }
php.ini
[XDebug] zend_extension = xdebug xdebug.mode = debug xdebug.start_with_request = trigger xdebug.remote_port = 9000 xdebug.client_port = 9000
场景对比
正常工作场景:单文件index.php
<?php $i = 1 + 4; echo $i; // 此处断点正常触发
无法工作场景:Laravel项目/routes/web.php
<?php Route::get('/test-breakpoint', function() { $i = 1 + 4; echo $i; // 此处断点无法触发 });
内容的提问来源于stack exchange,提问作者Linesofcode
相关产品推荐
相关产品推荐

