很多人不知道的是,php框架如thinkphp,laravel等都是可以debug的。

首先需要下载对应的xdebug配置文件,并且在在php.ini中配置好相关参数

附xdebug配置:

[XDebug]
xdebug.profiler_output_dir="D:\phpStudy\tmp\xdebug"
xdebug.remote_enable=1
xdebug.trace_output_dir="D:\phpStudy\tmp\xdebug"
xdebug.remote_host=app.cn //给框架配置的配置的vhost
zend_extension="D:\phpStudy\php\php-7.1.16-nts\ext\php_xdebug.dll"
xdebug.idekey = "PHPSTORM"

xdebug.profiler_enable_trigger_value=PHPXDEBUG
xdebug.profiler_enable_trigger=1
xdebug.profiler_enable=on
xdebug.remote_connect_back=on
  • 首先配置好xdebug等相关的,如果能够用浏览器debug的话,就说明配置好了
  • 打好断点,使用postman进行debug时只需要在你的url后面加上一个get参数:?XDEBUG_SESSION_START=PHPSTORM
    url?XDEBUG_SESSION_START=PHPSTORM,这个时候就会进入断点。

-------------更新phpstorm下cli模式的debug----------------------

php -dxdebug.remote_enable=1 -dxdebug.remote_autostart=on -dxdebug.remote_mode=req -dxdebug.remote_port=9000 -dxdebug.remote_host=127.0.0.1 artisan my:command

标签: none

评论已关闭