手机
当前位置:查字典教程网 >编程开发 >php教程 >PHP在线调试执行的实现方法(附demo源码)
PHP在线调试执行的实现方法(附demo源码)
摘要:本文实例讲述了PHP在线执行的实现方法。分享给大家供大家参考,具体如下:运行效果截图如下:run.php文件如下:调试php代码iframe...

本文实例讲述了PHP在线执行的实现方法。分享给大家供大家参考,具体如下:

运行效果截图如下:

PHP在线调试执行的实现方法(附demo源码)1

run.php文件如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <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> <tr> <form action="./run2.php" target="run_iframe" method="post"> <td valign="top" align="center"> <textarea name="php_code" cols="50" rows="43"><?php echo file_get_contents('./run3.php'); ?></textarea> </td> <td valign="middle"><button type="submit">执行</button></td> </form> <td valign="top"><iframe id="run_iframe" name="run_iframe" src="./run3.php" height="600px"></iframe></td> </tr> </table> </body> </html>

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程序设计有所帮助。

【PHP在线调试执行的实现方法(附demo源码)】相关文章:

PHP获取文件行数的方法

网站加速 PHP 缓冲的免费实现方法

PHP4引用文件语句的对比

php输出全球各个时区列表的方法

php调整服务器时间的方法

PHP调用三种数据库的方法(1)

php线性表的入栈与出栈实例分析

PHP递归调用数组值并用其执行指定函数的方法

留言板翻页的实现详解

php 类自动载入的方法

精品推荐
分类导航