php 調試工具
主要是三個文件
新建1, run.php
可根據自己屏幕大小調適合自己的css樣式
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 6 <title>調試php代碼</title> 7 </head> 8 <style> 9 iframe { 10 min-width: 700px; 11 } 12 13 textarea { 14 max-height: 700px 15 } 16 17 table { 18 margin: 0 auto; 19 } 20 </style> 21 22 <body> 23 <table border="0" width="100px"> 24 <tr> 25 <th>PHP 代碼調試</th> 26 <th></th> 27 <th></th> 28 </tr> 29 <tr> 30 <form action="./run2.php" target="run_iframe" method="post"> 31 <td valign="top" align="center"> 32 <textarea name="php_code" cols="100" rows="43"> 33 <?php 34 echo file_get_contents('./run3.php'); 35 ?> 36 </textarea> 37 </td> 38 <td valign="middle"><button type="submit" style=" width:60px;">執行</button></td> 39 </form> 40 <td valign="top"><iframe id="run_iframe" name="run_iframe" src="./run3.php" height="650px"></iframe></td> 41 </tr> 42 </table> 43 </body> 44 45 </html>
新建2,run2.php
1 <?php 2 $code = stripslashes($_POST['php_code']); 3 if (!strstr($code, '<?php')) 4 $code = '<?php' . PHP_EOL . $code; 5 file_put_contents('run3.php', $code); 6 header("Location:./run3.php");
新建3,run3.php
1 <?php 2 3 // echo phpinfo(); //空文件即可,執行后會自動寫入
php 環境 下
瀏覽器到服務目錄下運行run.php即可
效果圖如下
