開始
- 首先根據PHP的版本下載并安裝對應的Xdebug擴展
- 在phpStorm工具中找到設置
- 添加服務
- 添加php web page
- 配置完信息后
首先根據PHP的版本下載并安裝對應的Xdebug擴展
我使用的是phpStudy工具,直接在php對應的版本中開啟xdebug擴展,
并在php.ini中添加如下配置:
[Xdebug]
zend_extension=D:/xxx/phpstudy_pro/Extensions/php/php7.4.3nts/ext/php_xdebug.dll
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.auto_trace=Off
xdebug.trace_output_dir=D:/xxx/phpstudy_pro/Extensions/php_log/php7.4.3nts.xdebug.trace
xdebug.profiler_enable=Off
xdebug.profiler_output_dir=D:/xxx/phpstudy_pro/Extensions/php_log/php7.4.3nts.xdebug.profiler
xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.remote_port=9003
xdebug.remote_handler=dbgpxdebug.idekey="PHPSTORM"xdebug.remote_mode=req
xdebug.max_nesting_level=500
xdebug.remote_autostart=1
添加完配置信息之后,重啟php。
在phpStorm工具中找到設置
配置基本信息
添加服務
添加php web page
配置完信息后
設置斷點,將甲殼蟲右邊的電話按鈕,點擊到通話狀態:
然后,可以對這個接口發起請求,就可以調試了。