phpstrom xdebug 断点调试教程

之前在开发中经常使用var_dumpdie 进行调式
所以就研究了一下 phpstrom 的断点调式

  • 使用前提条件
    • 开启 php Xdebug 扩展
    • 在 php.ini 加上如下配置 (为了演示方便开发环境使用的是 wamp)
[xdebug]
zend_extension="c:/wamp64/bin/php/php7.2.4/zend_ext/php_xdebug-2.6.0-7.2-vc15-x86_64.dll"

xdebug.remote_enable = on
xdebug.auto_trace = On
xdebug.remote_handler = dbgp     
xdebug.remote_host = localhost  
xdebug.remote_port = 9000  
xdebug.idekey = PHPSTORM
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = Off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=0

  • 配置 phpstrom
    • 配置 File | Settings | Languages & Frameworks | PHP | Servers
      file
    • 配置 File | Settings | Languages & Frameworks | PHP | Debug | DBGp Proxy
      file
    • 配置 |Run|Debug Configurations
      • web 项目使用 PHP Web Page
        file
      • 普通项目直接使用PHP Script 即可

  • 开始 断点调式 (点击 phpstrom 右上方绿色小虫子图标即可开始)

    • 在 debug 栏 点击 红色向下 的箭头 可强制进入函数进行断点调式 如何代码就会一步步执行
      file
本作品采用《CC 协议》,转载必须注明作者和本文链接
本帖由系统于 4年前 自动加精
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 2

楼主用的是付费版phpstrom ?

5年前 评论

@select_and_action 穷学生,支持不起付费,学生可以用教育网免费使用 JetBrains 全家桶,我用学校邮箱激活的,这是phpstrom 2018.1 版本,网上用激活码激活和我的效果一模一样

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!