在PhpStorm上使用浏览器时如何调试代码 [英] How to debug code while using my browser on PhpStorm
问题描述
我无法通过PhpStorm和Xdebug调试Laravel.
I cannot debug Laravel via PhpStorm and Xdebug.
当我尝试通过PhpStorm调试单个文件时,它可以正常工作,但是当我设置一个断点并在浏览器中尝试它时,它不起作用.
When I try to debug a single file via PhpStorm, it works fine, but when I set a breakpoint and try it on the browser, it doesn't work.
PhpStorm等待带有ide键的传入连接,并在那里停止.
PhpStorm waits for incoming connection with ide key and it stops there.
推荐答案
我设置的工作流程:
- 使用类似 Xdebug助手的东西.
- 配置它以使用PhpStorm IDE密钥.
- Use something like Xdebug helper.
- Configure it to use PhpStorm IDE Key.
要调试时:
- 激活Xdebug助手(标记
Debug
) - 转到PhpStorm和
Run > Start listening for PHP Debug Connections
- 在代码中放置一个断点
- 在Chrome中刷新页面(或转到另一个页面,只需发出请求).
- Activate Xdebug Helper (Mark
Debug
) - Go to PhpStorm and
Run > Start listening for PHP Debug Connections
- Put a breakpoint at your code
- Refresh your page in Chrome (or go to another one, just make a request).
基本上,Xdebug帮助器将成为您的触发器.如果禁用它,PhpStorm将不再调试您的代码.
Basically, the Xdebug Helper will be your trigger. If you disable it, PhpStorm no longer will debug your code.
如果您不想中继扩展,则可以转到Xdebug配置并设置:
If you don't want to relay on an extension, you can go to your Xdebug config and set:
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=1
并且开始侦听PHP调试连接"将是您的触发器.
And "Start listening for PHP Debug Connections" will be your trigger.
这篇关于在PhpStorm上使用浏览器时如何调试代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!