exception.tpl 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. if(!function_exists('parse_padding')){
  3. function parse_padding($source){
  4. $length = strlen(strval(count($source['source']) + $source['first']));
  5. return 40 + ($length - 1) * 8;
  6. }
  7. }
  8. if(!function_exists('parse_class')){
  9. function parse_class($name){
  10. $names = explode('\\', $name);
  11. return '<abbr title="'.$name.'">'.end($names).'</abbr>';
  12. }
  13. }
  14. if(!function_exists('parse_file')){
  15. function parse_file($file, $line){
  16. return '<a class="toggle" title="'."{$file} line {$line}".'">'.basename($file)." line {$line}".'</a>';
  17. }
  18. }
  19. ?>
  20. <!DOCTYPE html>
  21. <html>
  22. <head>
  23. <meta charset="UTF-8">
  24. <title>系统发生错误</title>
  25. <meta name="robots" content="noindex,nofollow" />
  26. <style>
  27. body{color:#333;font:16px Verdana,"Helvetica Neue",helvetica,Arial,'Microsoft YaHei',sans-serif;margin:0;padding:0 20px 20px}
  28. .info{padding:10px;background: #FFF;}
  29. h1{font-size:18px;font-weight:500;line-height:32px}
  30. h2{color:#4288ce;font-weight:400;padding:6px 0;margin:6px 0 0;font-size:18px;border-bottom:1px solid #eee}
  31. h3{margin:12px;font-size:16px;font-weight:bold}
  32. abbr{cursor:help;text-decoration:underline;text-decoration-style:dotted}
  33. a{color:#868686;cursor:pointer}
  34. a:hover{text-decoration:underline}.line-error{background:#f8cbcb}
  35. .echo table{width:100%}
  36. .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{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,"微软雅黑"}
  37. .exception .trace ol{margin:12px}
  38. .exception .trace ol li{padding:2px 4px}
  39. .exception div:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px}
  40. </style>
  41. </head>
  42. <body>
  43. <div class="echo"><?php echo $echo;?></div>
  44. <?php if(\think\facade\App::isDebug()) { ?>
  45. <div class="exception">
  46. <div class="message">
  47. <div class="info">
  48. <div>
  49. <h2>[<?php echo $code; ?>]&nbsp;<?php echo sprintf('%s in %s', parse_class($name), parse_file($file, $line)); ?></h2>
  50. </div>
  51. <div><h1><?php echo nl2br(htmlentities($message)); ?></h1></div>
  52. </div>
  53. </div>
  54. <?php if(!empty($source)){?>
  55. <div class="source-code">
  56. <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>
  57. </div>
  58. <?php }?>
  59. </div>
  60. <?php } else { ?>
  61. <div class="exception"><div class="info"><h1><?php echo htmlentities($message); ?></h1></div></div>
  62. <?php } ?>
  63. </body>
  64. </html>