1. 程式人生 > 程式設計 >phpStudy vscode 搭建debug除錯的教程詳解

phpStudy vscode 搭建debug除錯的教程詳解

下載地址

phpstudy:https://www.xp.cn/download.html
vscode:https://code.visualstudio.com/ 設定
phpstudy版本:7.3.4nts

在這裡插入圖片描述

[Xdebug]
zend_extension=D:/phpstudy_pro/Extensions/php/php7.3.4nts/ext/php_xdebug.dll
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.auto_trace=On
xdebug.trace_output_dir=D:/phpstudy_pro/Extensions/php_log/php7.3.4nts.xdebug.trace
xdebug.profiler_enable=On
xdebug.profiler_output_dir=D:/phpstudy_pro/Extensions/php_log/php7.3.4nts.xdebug.profiler
xdebug.remote_enable=On
xdebug.remote_autostart=On
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp

vscode :
ctrl+,調出setting,或則檔案->首選項->設定

在這裡插入圖片描述

php路徑設定

{
  "window.zoomLevel": 1,"git.confirmSync": false,"git.autofetch": true,"[javascript]": {
    "editor.defaultFormatter": "vscode.typescript-language-features"
  },//關鍵點
  "php.validate.executablePath": "D:/phpstudy_pro/Extensions/php/php7.3.4nts/php.exe"
}

Xdebug設定

{
  // 使用 IntelliSense 瞭解相關屬性。 
  // 懸停以檢視現有屬性的描述。
  // 欲瞭解更多資訊,請訪問: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0","configurations": [
    {
      "name": "Listen for XDebug","type": "php","request": "launch",//埠
      "port": 9000
    },{
      "name": "Launch currently open script","program": "${file}","cwd": "${fileDirname}",//埠
      "port": 9000
    }
  ]
}

驗證

在這裡插入圖片描述

vscode F5啟動除錯

瀏覽器輸入:localhost/test.php

在這裡插入圖片描述

到此這篇關於phpStudy vscode 搭建debug除錯的教程詳解的文章就介紹到這了,更多相關phpStudy vscode 搭建debug除錯內容請搜尋我們以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援我們!