出现错误:显示指定的内容

'app_debug'              => false, //关闭调试

找到错误模板:

    // 异常页面的模板文件'exception_tmpl'         => Env::get('think_path') . 'tpl/think_exception.tpl',

think_exception.tpl代码:

代码修改处:

<?phpif(!function_exists('parse_padding')){function parse_padding($source){$length  = strlen(strval(count($source['source']) + $source['first']));return 40 + ($length - 1) * 8;}}if(!function_exists('parse_class')){function parse_class($name){$names = explode('\\', $name);return '<abbr title="'.$name.'">'.end($names).'</abbr>';}}if(!function_exists('parse_file')){function parse_file($file, $line){return '<a class="toggle" title="'."{$file} line {$line}".'">'.basename($file)." line {$line}".'</a>';}}if(!function_exists('parse_args')){function parse_args($args){$result = [];foreach ($args as $key => $item) {switch (true) {case is_object($item):$value = sprintf('<em>object</em>(%s)', parse_class(get_class($item)));break;case is_array($item):if(count($item) > 3){$value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3)));} else {$value = sprintf('[%s]', parse_args($item));}break;case is_string($item):if(strlen($item) > 20){$value = sprintf('\'<a class="toggle" title="%s">%s...</a>\'',htmlentities($item),htmlentities(substr($item, 0, 20)));} else {$value = sprintf("'%s'", htmlentities($item));}break;case is_int($item):case is_float($item):$value = $item;break;case is_null($item):$value = '<em>null</em>';break;case is_bool($item):$value = '<em>' . ($item ? 'true' : 'false') . '</em>';break;case is_resource($item):$value = '<em>resource</em>';break;default:$value = htmlentities(str_replace("\n", '', var_export(strval($item), true)));break;}$result[] = is_int($key) ? $value : "'{$key}' => {$value}";}return implode(', ', $result);}}
?>
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><title>系统发生错误</title><meta name="robots" content="noindex,nofollow" /><style>/* Base */body {color: #333;font: 16px Verdana, "Helvetica Neue", helvetica, Arial, 'Microsoft YaHei', sans-serif;margin: 0;padding: 0 20px 20px;}h1{margin: 10px 0 0;font-size: 28px;font-weight: 500;line-height: 32px;}h2{color: #4288ce;font-weight: 400;padding: 6px 0;margin: 6px 0 0;font-size: 18px;border-bottom: 1px solid #eee;}h3{margin: 12px;font-size: 16px;font-weight: bold;}abbr{cursor: help;text-decoration: underline;text-decoration-style: dotted;}a{color: #868686;cursor: pointer;}a:hover{text-decoration: underline;}.line-error{background: #f8cbcb;}.echo table {width: 100%;}.echo pre {padding: 16px;overflow: auto;font-size: 85%;line-height: 1.45;background-color: #f7f7f7;border: 0;border-radius: 3px;font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;}.echo pre > pre {padding: 0;margin: 0;}/* Exception Info */.exception {margin-top: 20px;}.exception .message{padding: 12px;border: 1px solid #ddd;border-bottom: 0 none;line-height: 18px;font-size:16px;border-top-left-radius: 4px;border-top-right-radius: 4px;font-family: Consolas,"Liberation Mono",Courier,Verdana,"微软雅黑";}.exception .code{float: left;text-align: center;color: #fff;margin-right: 12px;padding: 16px;border-radius: 4px;background: #999;}.exception .source-code{padding: 6px;border: 1px solid #ddd;background: #f9f9f9;overflow-x: auto;}.exception .source-code pre{margin: 0;}.exception .source-code pre ol{margin: 0;color: #4288ce;display: inline-block;min-width: 100%;box-sizing: border-box;font-size:14px;font-family: "Century Gothic",Consolas,"Liberation Mono",Courier,Verdana;padding-left: <?php echo (isset($source) && !empty($source)) ? parse_padding($source) : 40;  ?>px;}.exception .source-code pre li{border-left: 1px solid #ddd;height: 18px;line-height: 18px;}.exception .source-code pre code{color: #333;height: 100%;display: inline-block;border-left: 1px solid #fff;font-size:14px;font-family: Consolas,"Liberation Mono",Courier,Verdana,"微软雅黑";}.exception .trace{padding: 6px;border: 1px solid #ddd;border-top: 0 none;line-height: 16px;font-size:14px;font-family: Consolas,"Liberation Mono",Courier,Verdana,"微软雅黑";}.exception .trace ol{margin: 12px;}.exception .trace ol li{padding: 2px 4px;}.exception div:last-child{border-bottom-left-radius: 4px;border-bottom-right-radius: 4px;}/* Exception Variables */.exception-var table{width: 100%;margin: 12px 0;box-sizing: border-box;table-layout:fixed;word-wrap:break-word;            }.exception-var table caption{text-align: left;font-size: 16px;font-weight: bold;padding: 6px 0;}.exception-var table caption small{font-weight: 300;display: inline-block;margin-left: 10px;color: #ccc;}.exception-var table tbody{font-size: 13px;font-family: Consolas,"Liberation Mono",Courier,"微软雅黑";}.exception-var table td{padding: 0 6px;vertical-align: top;word-break: break-all;}.exception-var table td:first-child{width: 28%;font-weight: bold;white-space: nowrap;}.exception-var table td pre{margin: 0;}/* Copyright Info */.copyright{margin-top: 24px;padding: 12px 0;border-top: 1px solid #eee;}/* SPAN elements with the classes below are added by prettyprint. */pre.prettyprint .pln { color: #000 }  /* plain text */pre.prettyprint .str { color: #080 }  /* string content */pre.prettyprint .kwd { color: #008 }  /* a keyword */pre.prettyprint .com { color: #800 }  /* a comment */pre.prettyprint .typ { color: #606 }  /* a type name */pre.prettyprint .lit { color: #066 }  /* a literal value *//* punctuation, lisp open bracket, lisp close bracket */pre.prettyprint .pun, pre.prettyprint .opn, pre.prettyprint .clo { color: #660 }pre.prettyprint .tag { color: #008 }  /* a markup tag name */pre.prettyprint .atn { color: #606 }  /* a markup attribute name */pre.prettyprint .atv { color: #080 }  /* a markup attribute value */pre.prettyprint .dec, pre.prettyprint .var { color: #606 }  /* a declaration; a variable name */pre.prettyprint .fun { color: red }  /* a function name */*{margin: 0;padding: 0;box-sizing: border-box;}.all_error{width: 800px;margin: 80px auto;}.all_error img{width: 100%;display: block;}.all_error p{text-align: center;color: #666;font-size: 20px;font-family: "microsoft yahei";margin-top: 30px;}.all_error .all_error_a{width: 500px;margin: 80px auto 0;text-align: center;}.all_error .all_error_a a{width: 150px;height: 45px;display: inline-block;border: 2px solid #999999;text-decoration: none;text-align: center;line-height: 42px;border-radius: 50px;font-size: 16px;}.all_error .all_error_a .go_index{color: #333333;margin-right: 60px;}.all_error .all_error_a .set_onlond{color: #fff;background: #999999;}</style>
</head>
<body><div class="echo"><?php echo $echo;?></div><?php if(\think\facade\App::isDebug()) { ?><div class="exception"><div class="message"><div class="info"><div><h2>[<?php echo $code; ?>]&nbsp;<?php echo sprintf('%s in %s', parse_class($name), parse_file($file, $line)); ?></h2></div><div><h1><?php echo nl2br(htmlentities($message)); ?></h1></div></div></div><?php if(!empty($source)){?><div class="source-code"><pre class="prettyprint lang-php"><ol start="<?php echo $source['first']; ?>"><?php foreach ((array) $source['source'] as $key => $value) { ?><li class="line-<?php echo $key + $source['first']; ?>"><code><?php echo htmlentities($value); ?></code></li><?php } ?></ol></pre></div><?php }?><div class="trace"><h2>Call Stack</h2><ol><li><?php echo sprintf('in %s', parse_file($file, $line)); ?></li><?php foreach ((array) $trace as $value) { ?><li><?php // Show Functionif($value['function']){echo sprintf('at %s%s%s(%s)', isset($value['class']) ? parse_class($value['class']) : '',isset($value['type'])  ? $value['type'] : '', $value['function'], isset($value['args'])?parse_args($value['args']):'');}// Show lineif (isset($value['file']) && isset($value['line'])) {echo sprintf(' in %s', parse_file($value['file'], $value['line']));}?></li><?php } ?></ol></div></div><?php } else { ?><div class="exception"><div class="all_error"><?php $root=request()->root(true)."/static/images/404.png"; ?><img src="<?php echo $root;?>"/><p>Error,页面出错啦!!!请点击返回首页或者刷新页面~</p><div class="all_error_a"><a href="<?php echo request()->root(true);?>" class="go_index">返回首页</a><a href="" class="set_onlond">刷新页面</a> </div></div><!-- <div class="info"><h1><?php echo htmlentities($message);?></h1></div> --></div><?php } ?><?php if(!empty($datas)){ ?><div class="exception-var"><h2>Exception Datas</h2><?php foreach ((array) $datas as $label => $value) { ?><table><?php if(empty($value)){ ?><caption><?php echo $label; ?><small>empty</small></caption><?php } else { ?><caption><?php echo $label; ?></caption><tbody><?php foreach ((array) $value as $key => $val) { ?><tr><td><?php echo htmlentities($key); ?></td><td><?php if(is_array($val) || is_object($val)){ echo htmlentities(json_encode($val, JSON_PRETTY_PRINT));} else if(is_bool($val)) { echo $val ? 'true' : 'false';} else if(is_scalar($val)) {echo htmlentities($val);} else {echo 'Resource';}?></td></tr><?php } ?></tbody><?php } ?></table><?php } ?></div><?php } ?><?php if(!empty($tables)){ ?><div class="exception-var"><h2>Environment Variables</h2><?php foreach ((array) $tables as $label => $value) { ?><table><?php if(empty($value)){ ?><caption><?php echo $label; ?><small>empty</small></caption><?php } else { ?><caption><?php echo $label; ?></caption><tbody><?php foreach ((array) $value as $key => $val) { ?><tr><td><?php echo htmlentities($key); ?></td><td><?php if(is_array($val) || is_object($val)){ echo htmlentities(json_encode($val, JSON_PRETTY_PRINT));} else if(is_bool($val)) { echo $val ? 'true' : 'false';} else if(is_scalar($val)) {echo htmlentities($val);} else {echo 'Resource';}?></td></tr><?php } ?></tbody><?php } ?></table><?php } ?></div><?php } ?><!--     <div class="copyright"><a title="官方网站" href="http://www.thinkphp.cn">ThinkPHP</a> <span>V<?php echo \think\facade\App::version(); ?></span> <span>{ 十年磨一剑-为API开发设计的高性能框架 }</span></div> --><?php if(\think\facade\App::isDebug()) { ?><script>var LINE = <?php echo $line; ?>;function $(selector, node){var elements;node = node || document;if(document.querySelectorAll){elements = node.querySelectorAll(selector);} else {switch(selector.substr(0, 1)){case '#':elements = [node.getElementById(selector.substr(1))];break;case '.':if(document.getElementsByClassName){elements = node.getElementsByClassName(selector.substr(1));} else {elements = get_elements_by_class(selector.substr(1), node);}break;default:elements = node.getElementsByTagName();}}return elements;function get_elements_by_class(search_class, node, tag) {var elements = [], eles, pattern  = new RegExp('(^|\\s)' + search_class + '(\\s|$)');node = node || document;tag  = tag  || '*';eles = node.getElementsByTagName(tag);for(var i = 0; i < eles.length; i++) {if(pattern.test(eles[i].className)) {elements.push(eles[i])}}return elements;}}$.getScript = function(src, func){var script = document.createElement('script');script.async  = 'async';script.src    = src;script.onload = func || function(){};$('head')[0].appendChild(script);};(function(){var files = $('.toggle');var ol    = $('ol', $('.prettyprint')[0]);var li    = $('li', ol[0]);   // 短路径和长路径变换for(var i = 0; i < files.length; i++){files[i].ondblclick = function(){var title = this.title;this.title = this.innerHTML;this.innerHTML = title;}}// 设置出错行var err_line = $('.line-' + LINE, ol[0])[0];err_line.className = err_line.className + ' line-error';$.getScript('//cdn.bootcss.com/prettify/r298/prettify.min.js', function(){prettyPrint();// 解决Firefox浏览器一个很诡异的问题// 当代码高亮后,ol的行号莫名其妙的错位// 但是只要刷新li里面的html重新渲染就没有问题了if(window.navigator.userAgent.indexOf('Firefox') >= 0){ol[0].innerHTML = ol[0].innerHTML;}});})();</script><?php } ?>
</body>
</html>

效果:

tp51 自定义404界面的配置相关推荐

  1. Mac typora自定义编辑界面的配置

    打开设置,选择Appearance->Open Theme Folder 然后打开一个文件夹,在文件夹下新建文件:base.user.css 在文件中写入想要的配置,然后重启Typora即可. ...

  2. linux中httpd错误页面图片,自定义404页面

    呵呵,我看大前端上没有404的相关文章,于是就拿过来了. 自定义404界面.懂得人可以无视,毕竟我是初学者哈. 看我的这个图片: 当然,上面的东西是我自己编的,在出现无法找到所请求的页面的时候,会进行 ...

  3. java怎么设置404界面_如何使用Spring MVC显示自定义的404 Not Found页面

    本篇文章给大家带来的内容是关于如何使用Spring MVC显示自定义的404 Not Found页面,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. 不知道大家对千篇一律的404 No ...

  4. GithubPage自定义腾讯404界面

    思路来源 之前看到腾讯网络的404和github自带的404,反差很大,于是想自己弄一个了. 过程 github的404一点也不复杂,只是需要在根目录添加一个404.html的文档,或者404.md的 ...

  5. FineReport中如何自定义登录界面

    在登录平台时,不希望使用FR默认的内置登录界面,想通过自定义登录界面实现登录操作,内置登录界面如下图: 登录界面,获取到用户名和密码的值,发送到报表系统,报表服务带着这两个参数访问认证地址进行认证. ...

  6. android webview 自定义404错误页面!

    自定义404页面.android的webview 控件可以加载网页,webview有两个方法:webView.setWebChromeClient和webView.setWebViewClient. ...

  7. python自定义全局异常_Django 自定义404 500等错误页面的实现

    在开发网站的过程中,404,500错误,是不可避免产生的. 一旦产生了这种错误,很多可以通过web server 来处理.比如使用 apache 的定义 或者nginx 的定义.都可以定向处理.如果单 ...

  8. android webview 加载进度和自定义404错误页面

    原帖地址:http://www.cnblogs.com/winxiang/archive/2012/10/25/2738320.html 自定义404页面.android的webview 控件可以加载 ...

  9. 在ASP.NET MVC3项目中,自定义404错误页面

    在Web开发中,用户体验是至关重要的,一个友好的网站自然少不了自定义404错误页面. 让笔者为大家介绍404错误页面在ASP.NET MVC3项目中的配置: 第一步,在项目的Web.config文件中 ...

  10. Wix 安装部署(二)自定义安装界面和行为

    Wix 安装部署(二)自定义安装界面和行为 原文:Wix 安装部署(二)自定义安装界面和行为 上一篇介绍了如何联合MSBuild来自动生成打包文件和对WIX的一些初步认识,http://www.cnb ...

最新文章

  1. html和css之间有什么区别,html语法和css语法之间有什么区别
  2. shell中的mput_FTP命令详解 及 shell中的使用
  3. C++ Primer 5th笔记(chap 16 模板和泛型编程)模板特例化
  4. CentOS登录root账户
  5. Spring Cloud Security:Oauth2结合JWT使用
  6. bash知识点:文件测试
  7. 一点关于cloze-style问题的简谈
  8. abaqus失效单元删除_abaqus单元删除的一般方法
  9. 【commons-httpclient】Java中HttpClient工具访问Web请求
  10. 拓端tecdat|python中的copula:Frank、Clayton和Gumbel copula模型估计与可视化
  11. 解决eclipse编辑jsp、js文件时,经常出现卡死的问题
  12. 六年级上册计算机教材分析,人教版六年级上册数学教材分析
  13. BZOJ1597土地购买 【斜率优化DP】
  14. 飞鱼星行为管理路由器【限制视频】方法(网页+客户端)
  15. dbm数据库详解【flask】【dbm.gun解决】
  16. 坦克大战Netty网络联机版项目笔记
  17. 【工具脚本】目标检测数据样本的扩增脚本
  18. error pulling image configuration:XXX net/http: TLS handshake timeout
  19. 快速入门JavaScript(一)
  20. java---约数个数(每日一道算法2022.9.10)

热门文章

  1. eclipse安装程序无法启动
  2. JTAG Bypass命令案例解析
  3. 视频教程-Linux从入门到精通-Linux
  4. ps黑作坊终极天空大师 一键换天空终极版破解版扩展面板
  5. echarts-map的使用
  6. cruise软件模型,cruise增程混动仿真模型,功率跟随控制策略,Cruise混动仿真模型,串联混动汽车动力性经济性仿真
  7. carrot2_热门的错误人类天气机器人CARROT终于在Android上推出
  8. 独立游戏大电影观后感
  9. 【180929】仿微信飞机大战游戏源码
  10. ANDROID框架揭秘.pdf