一、首先安裝xdebug
安裝xdebug比 ,運行php -i >phpinfo.txt 或者 echo phpinfo();將全部信息貼到https://xdebug.org/wizard.php這個網站
如圖:
然后會跳轉到這個頁面:
這是我電腦上php.ini的配置
[xdebug]
zend_extension ="D:/php/php7.3.8/ext/php_xdebug-2.7.2-7.3-vc15-nts-x86_64.dll"
xdebug.remote_enable = On
;啟用性能檢測分析
xdebug.profiler_enable = On
;啟用代碼自動跟蹤
xdebug.auto_trace=On
xdebug.profiler_enable_trigger = On
xdebug.profiler_output_name = cachegrind.out.%t.%p
;指定性能分析文件的存放目錄
xdebug.profiler_output_dir ="D:/php/tmp"
xdebug.show_local_vars=0
xdebug.idkey="PHPSTORM"
;配置端口和監聽的域名
xdebug.remote_port=9000
xdebug.remote_host="localhost"
到此php這邊配置完畢。
成功后的phpinfo
2.phpstorm對接xdebug
打開phpstorm,file—>settting,
接下來就可以為項目debug配置
右上角
到此就可進行斷點調試了
若想直接在phpstorm上進行api調試可以安裝插件