如何使用 xdebug 跟踪我的卷曲

How can I track my curl with xdebug

我曾尝试将 Xdebug 与 sublime 结合使用,成功了。我想跟踪我的 curl 代码,例如:

我打开了一个URLhttp://localhost:8001/test/show,我的断点在test.php文件,可以了。在 test.php 中,我使用 curl 调用 http://localhost:8002/api/show,我想在 api.php 文件中添加断点,但它在 api.php 上不起作用。我该怎么做?谢谢。

尝试将 XDEBUG_SESSION cookie 添加到您的 curl 请求中:

curl -i -X POST -d '{"some":"data"}' http://your-local-domain -b XDEBUG_SESSION=PHPSTORM

可选 path cookie:

curl --cookie "XDEBUG_SESSION=PHPSTORM;path=/;" localhost