index.html
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>调试php代码</title> </head> <style> iframe{ min-width:600px;} textarea{ max-height:600px} table{ margin:0 auto;} </style> <body> <table border="0" width="100px"> <tr> <th>PHP 代码调试</th> <th></th> <th>执行显示</th> </tr> <?php if (file_exists(\'./run1.php\') != "1") { $myfile = fopen("./run1.php", "w"); $txt = "<?php echo \'测试\'; ?>\n"; fwrite($myfile, $txt); fclose($myfile); } ?> <tr> <form action="./run.php" target="run_iframe" method="post"> <td valign="top" align="center"><textarea name="php_code" cols="50" rows="43">
<?php echo file_get_contents(\'./run1.php\');?>
</textarea></td> <td valign="middle"><button type="submit" style=" width:60px;">执行</button></td> </form> <td valign="top"><iframe id="run_iframe" name="run_iframe" src="./run1.php" height="600px"></iframe></td> </tr> </table> </body> </html>
run.php
<?php $code = stripslashes($_POST[\'php_code\']); if(!strstr($code,\'<?php\')) $code = \'<?php\'.PHP_EOL.$code ; file_put_contents(\'run1.php\',$code); header("Location:./run1.php"); ?>