微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PHP在线运行

index.html

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4 <Meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <title>调试PHP代码</title>
 6 </head>
 7 <style>
 8  iframe{ min-width:600px;}
 9  textarea{ max-height:600px}
10  table{ margin:0 auto;}
11 </style>
12 <body>
13 <table border="0" width="100px">
14 <tr>
15 <th>PHP 代码调试</th>
16 <th></th>
17 <th></th>
18 </tr>
19 
20 <tr>
21 
22 <form action="./run.PHP" target="run_iframe" method="post">
23 <td valign="top" align="center"><textarea name="PHP_code" cols="50" rows="43"><?PHP echo file_get_contents('./run1.PHP');?></textarea></td>
24 <td valign="middle"><button type="submit" style=" width:60px;">执行</button></td>
25 </form>
26 
27 <td valign="top"><iframe id="run_iframe" name="run_iframe" src="./run1.PHP"  height="600px"></iframe></td>
28 
29 </tr>
30 </table>
31 </body>
32 </html>

 

run.PHP

 1 <?PHP
 2     $code = stripslashes($_POST['PHP_code']);
 3           
 4     if(!strstr($code,'<?PHP'))
 5         $code = '<?PHP'.PHP_EOL.$code ;
 6         
 7     file_put_contents('run1.PHP',$code);    
 8     
 9     header("Location:./run1.PHP");
10 ?>

run1.PHP(自己创建)

源码:https://files.cnblogs.com/files/cyhms/i.zip

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐