linlf03

PHPStorm 调式JS /同时调式PHP和jS

一、PHPStorm 调式Javascript

在PHP Storm中创建test.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test page</title>
    <script>
       var test;
       var test2;
       console.log("hello world!");
       console.log("hello world3!");
    </script>
</head>
<body>
<p>Test</p>
</body>
</html>

 在test.html 文件中右键

选择Debug ‘test.html\' .

此时Chorme浏览器会提示安装JetBrain IDE Support。选择安装即可。

这样就可以在PHPStorm 中调式js了。

如下图,在PHp storm中按F8执行下一步

 参考 Debug JavaScript

 

二、PHP Storm同时调式php和js

创建php文件

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test page</title>
    <script src="tt.js" ></script>
</head>
<body>
<p>Test</p>
<a onclick="testClick()">test click</a>
<?php
echo  \'<br>\';
echo \'This is php code\';
echo \'This is php code2\';
?>
</body>
</html>

其中tt为js文件

var test;
var test2;
console.log("hello world!");
console.log("hello world3!");

function testClick(){
    console.log("test1");
    console.log("test2");
}

在PHP Storm配置如下:

设置好断点后启动调式即可。

源码链接:http://pan.baidu.com/s/1ge4IBRl 密码:be62

参考

Debugging PHP and JavaScript code at the same time in PhpStorm

 

分类:

技术点:

相关文章:

  • 2021-10-17
  • 2021-11-23
  • 2021-11-02
  • 2021-11-03
  • 2021-11-04
  • 2021-12-16
  • 2021-11-21
  • 2021-09-27
猜你喜欢
  • 2022-01-19
  • 2021-11-13
  • 2021-11-30
  • 2021-12-03
  • 2021-10-08
  • 2021-10-19
  • 2021-12-06
相关资源
相似解决方案