简体   繁体   English

Netbeans,xdebug:从浏览器开始调试

[英]Netbeans, xdebug : start debugging from browser

I have following problem about debugging PHP files in Netbeans using xdebug : when I debug directly PHP file everything works OK. 我有关于使用xdebugNetbeans调试PHP files问题:当我直接调试PHP file一切正常。

BUT: 但:

If I debug whole file (starts in index.html ) and after I click submit button which execute my PHP file , where is the breakpoint, It doesn't work. 如果我调试整个文件(在index.html启动),然后在我单击执行我的PHP file提交按钮后,断点在哪里,它不起作用。 I wanna put breakpoint to PHP file to see what info I've received from my form in HTML page. 我想把断点放到PHP file以查看我在HTML页面中从表单中收到的信息。

I want to stop program just after those 2 variables, sent through ajax: 我想在通过ajax发送的那两个变量之后停止程序:

$username = $_REQUEST["username"];
$password = $_REQUEST["password"];

Is it even possible?. 它甚至可能吗? Thank you! 谢谢!

For the Netbeans settings look at my answer it's for linux but may help you. 对于Netbeans设置,请查看我的答案,它可以帮助您。

In your index.html replace your action= with 在index.html中替换你的 action= with

<form action="yourphpfile.php?XDEBUG_SESSION_START=netbeans-xdebug" method="post" name="FormName">

It's not necessary to modify your form code to enable debugging, as suggested by another answer here. 如此处另一个答案所建议的,不必修改表单代码即可启用调试。

  1. Go to Project Properties > Run Configuration > Advanced... > Debug URL and check "Do not open web browser". 转到项目属性>运行配置>高级...>调试URL,然后选中“不要打开Web浏览器”。
  2. Do not set the Host under Debugger Proxy. 不要在调试器代理下设置主机。
  3. Save these settings. 保存这些设置。
  4. In the project window, go to Debug > Debug Project (Ctrl-F5). 在项目窗口中,转到调试>调试项目(Ctrl-F5)。 This starts listening for debug connections. 这开始侦听调试连接。 No browser is started, but you'll see "Waiting for connection..." in your status bar (bottom). 没有启动浏览器,但您会在状态栏(底部)中看到“等待连接...”。
  5. Install one of the plug-ins for your browser listed over at the 3rd step of Starting the Debugger . 启动调试器的第3步,为您列出的浏览器安装一个插件。
  6. Enable debugging with the browser plug-in you just installed. 使用刚安装的浏览器插件启用调试。
  7. Hit the URL you'd like to debug, fill out the form, and submit it. 点击您要调试的网址,填写表单并提交。

This answer was partially sourced from Launch XDebug in Netbeans on an external request . 此答案部分来自NetBeans中的Launch XDebug,是在外部请求下获得的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM