自己搭建本地 php 在线执行环境

php 调试工具

主要是三个文件

新建1, run.php

可根据自己屏幕大小调适合自己的css样式

<!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:700px;}
textarea{ max-height:700px}
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="100" rows="43"><?php
echo file_get_contents('./run3.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="./run3.php" height="650px"></iframe></td>
</tr>
</table>
</body>
</html>
 
新建2,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");
 
 
新建3,run3.php
 
<?php
// echo phpinfo();  //空文件即可,执行后会自动写入
 

php 环境 下
浏览器到服务目录下运行run.php即可
 
效果图如下
 

 
 

猜你喜欢

转载自www.cnblogs.com/haoyuekey/p/12800857.html
今日推荐