本文实例讲述了PHP在线执行的实现方法。分享给大家供大家参考,具体如下:
运行效果截图如下:
run.php文件如下:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>调试php代码</title><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><tr><td valign="top" align="center"><textarea name="php_code" cols="50" rows="43"></textarea></td><td valign="middle"><button type="submit" style="width:60px">执行</button></td><td valign="top"><iframe id="run_iframe" name="run_iframe" src="./run3.php" hei<span>!本文来源gaodai#ma#com搞*!代#%^码网5</span><pre>搞gaodaima代码
ght=”600px”></iframe>
run2.php文件如下:
<?php $code = stripslashes($_POST['php_code']); if(!strstr($code,'<?php')) $code = '<?php'.PHP_EOL.$code ; file_put_contents('run3.php',$code); header("Location:./run3.php");
完整实例代码点击此处本站下载。
希望本文所述对大家PHP程序设计有所帮助。