标签:在线 ace cookieCode cookie editor php 运行
今天分享一款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>
标签:在线,ace,cookieCode,cookie,editor,php,运行 来源: https://www.cnblogs.com/68xi/p/15114127.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。