最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

In phpStorm, how to put javascript breakpoint in a php file - Stack Overflow

programmeradmin4浏览0评论

I am new at the software phpStorm.

When I edit a html file, I can put break point on the javscript part, by clicking on the left of the code editor.

However, when I edit a php file, it doesn't work. It works only to put a break point on the php part of the code.

How can I put javascript break point on my php files?

I am new at the software phpStorm.

When I edit a html file, I can put break point on the javscript part, by clicking on the left of the code editor.

However, when I edit a php file, it doesn't work. It works only to put a break point on the php part of the code.

How can I put javascript break point on my php files?

Share Improve this question edited Mar 14, 2012 at 0:29 Oli asked Mar 14, 2012 at 0:22 OliOli 16k7 gold badges53 silver badges67 bronze badges 7
  • As always in IDE, when you click on the bar which is on the left of the code, you can add breakpoint. I've edited the question for more clarity. – Oli Commented Mar 14, 2012 at 0:28
  • If you have mixed php and js in a single file it is doubtfully you can do that – zerkms Commented Mar 14, 2012 at 0:30
  • Not 'as always'. Some have interactive debugging, some don't. Some do it for some languages but not others. Your question is highly specific to the IDE you're using. – Hamish Commented Mar 14, 2012 at 0:31
  • Yes, I've mixed php javascript and html... – Oli Commented Mar 14, 2012 at 0:32
  • @Hamish i disagree with the highly specific. Ive yet to see an IDE for PHP that doesnt have interactive debugging. – Ascherer Commented Mar 14, 2012 at 1:40
 |  Show 2 more ments

3 Answers 3

Reset to default 11

Add a debugger; line to your JavaScript code. For example:

alert("First.");
debugger; // Trigger a breakpoint.
alert("Second.");

If you want to debug the Javascript in PHPStorm (and not the Browser), you can do so by using the remote javascript debugging option.

A blog explaining this is here: http://tiger-fish./blog/using-phpstorm-debug-javascript

Short version: in the Javascript Debug configuration you set the start URL to the php file. And you map the *.js you want to debug.

On the official documentation page (2015), in section 5, it is written that there is no such possibility:

发布评论

评论列表(0)

  1. 暂无评论