当前位置: 首页 > news >正文

做网站 编程语言深圳31设计

做网站 编程语言,深圳31设计,网站建设需要的语言,工地招聘网站php动态高亮web源代码 注#xff1a;配置好不允许高亮的文件名#xff0c;安全第一 #php实现动态展示目录树结构源代码 适用于开放源代码#xff0c;结合html缓存使用效果更佳#xff0c;因循环较多不适合放首页 能力有限没实现行号 演示#xff1a;show source|开放…php动态高亮web源代码 注配置好不允许高亮的文件名安全第一 #php实现动态展示目录树结构源代码 适用于开放源代码结合html缓存使用效果更佳因循环较多不适合放首页 能力有限没实现行号 演示show source|开放源代码 效果截图 代码 4个文件放统一目录 1.php,1.html,net.js,showsource.php 1.php ?php header(Content-Type: text/html; charsetutf-8);define(root,str_replace(\\,/,realpath(__DIR__./../..))); $dir root; $res []; $root_dir $dir; $res tree($res,$dir); //$res preg_replace(/^.preg_quote($dir,/)./, root, $res); $data base64_encode(json_encode($res)); require 1.html; function tree($res,$dir) {global $root_dir;if(count($res)0){$res[][idsha1($dir),pid0,typedir,handle$dir,namesubstr($dir,strripos($dir,/)1,strlen($dir)),];}$handles array_merge(glob($dir . /.*), glob($dir . /*));$handles preg_replace(/^[\s\S]*\/\.$/,,$handles);$handles preg_replace(/^[\s\S]*\/\.\.$/,,$handles);$handles array_filter($handles);sort($handles);foreach ($handles as $item){if(is_dir($item)){$res[][idsha1($item),pidsha1($dir),typedir,handlepreg_replace(/^.preg_quote($root_dir,/)./,root,$item),namesubstr($item,strripos($item,/)1,strlen($item)),];tree($res,$item);}else{$res[][idsha1($item),pidsha1($dir),typefile,handlepreg_replace(/^.preg_quote($root_dir,/)./,root,$item),namesubstr($item,strripos($item,/)1,strlen($item)),];}}return $res; }function dump($snull,$return false) {ob_start();var_dump($s);$res ob_get_clean();$res preg_replace(/.preg_quote(],/).\n[\s]/m, ] , $res);switch (php_sapi_name()){case cgi-fcgi:$res preg_replace(/ /U, \t, $res);$res precode.$res./code/pre;if($return)return $res;echo $res;break;case cli:if($return)return $res;echo $res;break;} } 1.html !DOCTYPE html html langen headmeta charsetUTF-8titleshow source/titlestyle.tree {--spacing: 1.5rem;--radius: 10px;padding-left: 0;padding-right: 10px;}.tree li {display: block;position: relative;padding-left: calc(2 * var(--spacing) - var(--radius) - 2px);}.tree ul {margin-left: calc(var(--radius) - var(--spacing));padding-left: 0;}.tree ul li {border-left: 2px solid #ddd;}.tree ul li:last-child {border-color: transparent;}.tree ul li::before {content: ;display: block;position: absolute;top: calc(var(--spacing) / -2);left: -2px;width: calc(var(--spacing) 2px);height: calc(var(--spacing) 1px);border: solid #ddd;border-width: 0 0 2px 2px;}.tree summary {display: block;cursor: pointer;}.tree summary::marker,.tree summary::-webkit-details-marker {display: none;}.tree summary:focus {outline: none;}.tree summary:focus-visible {outline: 1px dotted #000;}.tree summary::before {content: ;display: block;position: absolute;top: calc(var(--spacing) / 2 - var(--radius));left: calc(var(--spacing) - var(--radius) - 1px);width: calc(2 * var(--radius));height: calc(2 * var(--radius));border-radius: 50%;background: #ddd;}.tree li a::after {content: ;display: block;position: absolute;top: calc(var(--spacing) / 2 - var(--radius));left: calc(var(--spacing) - var(--radius) - 1px);width: calc(2 * var(--radius));height: calc(2 * var(--radius));border-radius: 50%;background: #ddd;}.tree .active a::after {content: z;z-index: 1;background: #696;color: #fff;line-height: calc(2 * var(--radius) - 2px);text-align: center;}.tree .active a{color: #0a67fb;}.tree summary::before {content: ;z-index: 1;background: #696;color: #fff;line-height: calc(2 * var(--radius) - 2px);text-align: center;}.tree details[open] summary::before {content: −;}.tree ul li a {display: block;text-decoration: none;color: #222222;}.tree summary:hover{color: royalblue;}.tree a:hover{color: royalblue;}body{background: #fff;}.file-menu{background: #eee;}.source{/*background: royalblue;*/}.main{width: 100%;display: inline-flex;}.main .left{width: 30%;}.main .right{width: 70%;}.source{padding-left: 10px;}/style /head body div classmaindiv classleftdiv classfile-menuul idfile-list classtree/ul/div/divdiv classrightdiv idsource classsource/div/div /div script src/static/js/net.js/script scriptnet new Net();var data ?php echo $data; ?;data JSON.parse(atob(data));var tree treeFile(data);initFileList(tree);function showSource(obj) {document.querySelectorAll(#file-list .active).forEach(function (active) {active.classList.remove(active);});obj.parentElement.classList.add(active);let post_data {file:obj.dataset.file};net.post(showsource.php,dataJSON.stringify(post_data),function (data) {data JSON.parse(data);if(data.code!200){document.getElementById(source).textContentdata.msg;return;}document.getElementById(source).innerHTMLpredata.data/pre;});}function treeFile(data) {for (let i 0; i data.length; i) {data[i].childnodes [];data[i].list [];for (let j 0; j data.length; j) {if (data[j].pid data[i].id) {switch (data[j].type) {case dir:data[i].childnodes.push(data[j]);break;case file:data[i].list.push(data[j]);break;}}}}return data[0];}function initFileList(data) {var ul ;ul getFileList(data, ul);document.getElementById(file-list).innerHTML ul;document.querySelectorAll(#file-list a).forEach(function (link) {link.addEventListener(click, function (event) {event.preventDefault();showSource(link);});});}function getFileList(obj, ul) {ul li;ul details;ul summary obj.name /summary;ul ul;if (!(obj.childnodes.length 0)) {for (let key in obj.childnodes) {ul getFileList(obj.childnodes[key], ul);}}if (!(obj.list.length 0)) {for (let key in obj.list) {ul lia href# data-fileobj.list[key].handle obj.list[key].name /a/li;}}ul /ul;ul /details;ul /li;return ul;}/script /body /html net.js function Net() {this.xhr new XMLHttpRequest();this.get function (url, func, pram {}) {xhr this.xhr;xhr.onreadystatechange function () {if (this.readyState 4) {pram.code this.status;if (this.status 200) {func(this.responseText, pram);} else {func(this.responseText, pram);}}};xhr.open(get, url, false);xhr.send()};this.post function (url, data, func,pram {}) {xhr this.xhr;xhr.onreadystatechange function () {if (this.readyState 4) {pram.code this.status;if (this.status 200) {func(this.responseText,pram);} else {func(this.responseText,pram);}}};xhr.open(POST, url, false);xhr.setRequestHeader(Content-type, application/x-www-form-urlencoded);xhr.send(data)} } showsource.php ?php header(Content-Type: text/html; charsetutf-8);if(empty($_POST[data])){die; } $data $_POST[data]; $data json_decode($data,true); if(empty($data[file])){die; }define(root,str_replace(\\,/,realpath(__DIR__./../..))); $dir root; $root_dir $dir;$pass_files [root/app/conf.php, ]; $allow_ext [html,js,css,php,txt,xml,json, ];$file $data[file];if(in_array($file,$pass_files)){outSource(500,涉及配置不允许高亮,);die; } if(strpos($file,.)!false){$file_ext substr($file,strripos($file,.)1,strlen($file));if(!in_array($file_ext,$allow_ext)){outSource(500,只允许高亮.implode(|,$allow_ext).后缀文件,);die;} }$file preg_replace(/^root/,$root_dir,$file); if(!is_file($file)){outSource(500,文件不存在,);die; }$code highlight_file($file,true); outSource(200,,$code);function outSource($code,$msg,$data) {echo json_encode([code$code,msg$msg,data$data,],JSON_UNESCAPED_UNICODE); } 注配置好不允许高亮的文件名安全第一
http://www.pierceye.com/news/807408/

相关文章:

  • 网站报备查询android安卓软件下载
  • 百度站长平台网站验证wordpress关闭略缩图
  • 网站怎么做qq微信登陆界面设计的有趣的网站推荐
  • 设计logo网站赚钱注册域名怎么做网站
  • 网站备案 教程网站设计大全推荐
  • 临沂建设局网站官网文明网站建设工作进度表
  • 网站编辑seo旅游网站建设代码
  • 为什么自己做的网站打开是乱码wordpress live-2d
  • 素材下载网站电商自建站
  • 浙江省的网站建设公司有哪些代理注册公司一般多少钱
  • 如何在建设银行网站预约纪念币东莞网站建设服务有什
  • 有哪些可以做h5的网站代理网址上境外网
  • 做网站所需要的代码6红杏直播
  • 南通制作网站wordpress移动版设置
  • 哪个网站有免费ppt下载建筑类网站的推荐理由
  • 视觉差的网站公司外包
  • 基础做网站内蒙住房和城乡建设部网站
  • 发帖效果好的网站展馆展示设计公司排名
  • 童装网站建设文案什么网站做的号
  • 能打开的a站莆田网站建设建站系统
  • 上海市城乡建设管理局网站一个月做网站
  • 网站后台管理系统 aspwordpress拖拽上传
  • 华为手机官方网站登录爬虫做视频网站
  • 山东省工程建设信息官方网站河南网站seo推广
  • 低成本做网站 白之家重庆市建设执业资格注册管理中心网站
  • 电子商务网站建设需求在别的公司做的网站可以转走吗
  • 网站流量怎么做乡1万做网站需要几个人
  • 阿里云centos7做网站怀化网站seo
  • 我做的网站怎样被百度收录易语言 做网站mysql
  • 花店网站模板免费下载9个做简历的网站