且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用PhpStorm和Xdebug调试AJAX(POST)?

更新时间:2023-09-12 11:00:16

如果将Xdebug和PHPStorm配置为在正常加载页面时调试HTTP GET,则只需在Javascript的AJAX请求的URL中包含GET参数.例如: http://example.com/script.php?XDEBUG_SESSION_START=PHPSTORM

If Xdebug and PHPStorm are configured to debug HTTP GET when loading a page normally, then simply include the GET parameter in the URL of the AJAX request in your Javascript. For example: http://example.com/script.php?XDEBUG_SESSION_START=PHPSTORM

在PHPStorm中打开侦听",发送带有新URL的AJAX请求,调试器应捕获该请求.您要查找的POST数据应照常显示在$ _POST中.

Turn on Debug listening in PHPStorm, send the AJAX request with the new URL, and the debugger should catch it. The POST data you are looking for should appear in $_POST as usual.