PHPStorm 調式JS /同時調式PHP和jS


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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM