首页 > Web开发 > 详细

PHP在线运行

时间:2021-05-17 09:53:00      阅读:21      评论:0      收藏:0      [点我收藏+]

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

PHP在线运行

原文:https://www.cnblogs.com/cyhms/p/14775609.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!