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

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

一、PHPStorm 调式Javascript

在PHP Storm中创建test.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<! 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文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!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文件

1
2
3
4
5
6
7
8
9
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



本文转自Work Hard Work Smart博客园博客,原文链接:http://www.cnblogs.com/linlf03/p/5910289.html,如需转载请自行联系原作者

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值