vscode php調試

​一、安裝PHP Debugphp

插件PHP Extension Pack

2.vs code設置phpstorm

 

    ...ide

    ...spa

    "php.validate.executablePath""D:/BtSoft/WebSoft/php/7.1/php.exe",  插件

}debug

}3d

3.配置xdebug調試

建立一個test.php,建立一條語句phpinfo(),而後將獲得的信息粘貼到XDebug官網 XDebug installation wizard這個頁面中。這個頁面會分析好你的PHP環境code

下載XDebug.dllorm

複製到{phproot}/ext/

在{phproot}/php.ini中

[XDebug]
zend_extension = "D:\BtSoft\WebSoft\php\7.1\ext\php_xdebug-2.9.1-7.1-vc14-nts.dll"
xdebug.auto_trace=on
xdebug.collect_params=on
xdebug.collect_return=on
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
# 設置端口號,默認是9000,此處由於本地環境端口衝突故設置爲9001(在vscode配置中須要用到)
xdebug.remote_port = 9001
xdebug.remote_autostart=on
# 這是用於phpstorm中xdebug調試的配置,在vscode中沒有用到
xdebug.idekey = phpstorm

 

 

四、必須先打開您的php項目目錄,而後才能設置debug


 

  1. 點擊齒輪,選擇php--》選擇listen for xdebug

    端口設置爲9001


 


 

五、打開php文件,在按F9設置斷點, 點

啓動調試。
 

六、訪問可調試網頁

相關文章
相關標籤/搜索