終於把VSCODE XDEBUG配置搞定了
分享一下
1. VSCODE 安裝插件 PHP Debug( Debug supprot for PHP with XDebug);
2. VSCODE 調試選項卡下(在IDE的左側),點擊上邊的綠色箭頭右側的下拉框,選擇PHP,此時會彈出launch.json然后直接保存;
3. 選擇菜單 文件->首選項->設置,此時在右側上角,可以看到用戶設置和工作區設置,選擇工作區設置,然后添加如下代碼:
[Xdebug]
zend_extension="C:/Local/php5.6/ext/php_xdebug-2.5.1-5.6-vc11-nts.dll"紅色部分根據自己的安裝路徑進行修改;
xdebug.auto_trace=On
xdebug.collect_params=On
xdebug.collect_return=On
xdebug.profiler_enable=on
xdebug.trace_output_dir="C:\phpdebug"
xdebug.profiler_output_dir="C:\phpdebug"
xdebug.remote_enable = on
xdebug.remote_host = localhost
xdebug.remote_port = 9010 (此端口號需與launch.json中的端口號保持一致)
xdebug.remote_autostart = on
6.重啟PHP;
7.在VSCODE中的PHP文件下斷點,調試下拉框選擇Listen for XDebug, 按F5;
8.在瀏覽器中打開你的剛才下斷點的頁面,OK,VSCODE中已經斷下來了,盡情的調試吧。。哈哈