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
标签:files,php,在线,代码,600px,调试,PHP,运行 来源: https://www.cnblogs.com/cyhms/p/14775609.html