今天分享一款php在線運行學習工具,可以運行基礎php語法和調試基礎的php,是新手必備的工具,讓你隨時隨地學習php!
本源碼在也是一款開源項目,在前人基礎上修改的,新增了一些語法錯誤。

使用方法:把源代碼上傳php環境即可運行,php最低5.3以上版本,無需數據庫
覺得不錯,給個好評吧,讓我脫離新手區,之前老號被封了,只能用新號給大家分享好東西!
演示地址:http://www.myjiancai.net/php/
源碼:
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="shortcut icon" href="favicon.ico">
<title>PHP代碼在線運行工具</title>
<meta name="keywords" content="php在線運行工具,php在線調試工具">
<meta name="description" content="PHP代碼在線運行工具,讓您隨時隨地在線調試Php代碼!">
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<link rel="stylesheet" media="screen and (min-width: 1200px)" href="css/index.css" />
<link rel="stylesheet" media="screen and (max-width: 1200px)" href="css/mobile.css" />
</head>
<body>
<xmp id="editor"><?php
$str = 'World';
echo "Hello $str\n";
echo date('Y-m-d H:i:s').PHP_EOL;
echo "PHP版本:".phpversion();
?></xmp>
<textarea class="result" id="result" disabled></textarea>
<button class="runCodeButton" onclick="runCode(editor.getValue())">運行</button>
<button class="clearCodeButton" onclick="clearCode()">清除</button>
<script src="src/ace.js" type="text/javascript"></script>
<script src="src/ext-language_tools.js" type="text/javascript"></script>
<script>
var editor = ace.edit("editor");
//設置主題
editor.setTheme("ace/theme/monokai");
//設置程序語言
editor.session.setMode("ace/mode/php");
//設置輸入代碼提示
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
});
//自動換行,設置為off關閉
editor.setOption("wrap", "free");
//首次運行
$(document).ready(function () {
//獲取cookie
var cookieCode = getCookie("code");
//如果存在cookie,則取出並填在編輯器中
if (cookieCode != undefined && cookieCode != '') {
//將取出的cookie進行URLCode解碼,並將`替換為空格
cookieCode = decodeURIComponent(cookieCode).replace(/`/g, " ");
editor.setValue(cookieCode);
runCode(cookieCode);
} else {//如果不存在cookie,則運行初始代碼
runCode(editor.getValue());
}
//將光標移至末尾
editor.navigateFileEnd();
//監聽Ctrl+S命令
editor.commands.addCommand({
name: 'save',
bindKey: { win: 'Ctrl-S', mac: 'Command-S' },
exec: function (editor) {
download('phponline.php', editor.getValue());
},
readOnly: false // 如果不需要使用只讀模式,這里設置false
});
});
</script>
<!--演示地址!-->
<div id="foot" style="display:none">
<a href="http://www.myjiancai.net/">我的建材網</a>
</div>
</body>
</html>
