You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

218 lines
5.5 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  5. <title>KXcms Framework - 系统发生错误</title>
  6. <style type="text/css">
  7. * {
  8. padding: 0;
  9. margin: 0;
  10. }
  11. html {
  12. overflow-y: scroll;
  13. }
  14. body {
  15. background: #fff;
  16. font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
  17. "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
  18. SimSun, sans-serif;
  19. color: #333;
  20. }
  21. img {
  22. border: 0;
  23. }
  24. .copyright {
  25. padding: 12px 48px;
  26. color: #999;
  27. }
  28. .copyright a {
  29. color: #000;
  30. text-decoration: none;
  31. }
  32. html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, caption {
  33. border: 0;
  34. outline: 0;
  35. font-size: 100%;
  36. vertical-align: baseline;
  37. background: transparent;
  38. margin: 0;
  39. padding: 0;
  40. }
  41. body {
  42. line-height: 1;
  43. }
  44. ol, ul {
  45. list-style: none;
  46. }
  47. blockquote, q {
  48. quotes: none;
  49. }
  50. blockquote:before, blockquote:after, q:before, q:after {
  51. content: none;
  52. }
  53. :focus {
  54. outline: 0;
  55. }
  56. ins {
  57. text-decoration: none;
  58. }
  59. del {
  60. text-decoration: line-through;
  61. }
  62. table {
  63. border-collapse: collapse;
  64. border-spacing: 0;
  65. }
  66. body {
  67. font: normal 9pt "Verdana";
  68. color: #000;
  69. background: #fff;
  70. }
  71. h1 {
  72. font: normal 18pt "Verdana";
  73. color: #f00;
  74. margin-bottom: .5em;
  75. }
  76. h2 {
  77. font: normal 14pt "Verdana";
  78. color: #800000;
  79. margin-bottom: .5em;
  80. }
  81. h3 {
  82. font: bold 11pt "Verdana";
  83. }
  84. pre {
  85. font: normal 11pt Menlo, Consolas, "Lucida Console", Monospace;
  86. }
  87. .code pre {
  88. background-color: #ffe;
  89. margin: 0.5em 0;
  90. padding: 0.5em;
  91. line-height: 125%;
  92. border: 1px solid #eee;
  93. }
  94. .trace.collapsed pre {
  95. display: none;
  96. }
  97. .errorBox {
  98. padding: 12px 48px;
  99. }
  100. .big {
  101. font: 50px/1.8 "microsoft yahei"
  102. }
  103. .info {
  104. margin-bottom: 20px;
  105. }
  106. .title {
  107. font: bold 20px/1.8 "microsoft yahei"
  108. }
  109. .text {
  110. line-height: 2
  111. }
  112. pre span.error{display:block;background:#fce3e3;}
  113. pre span.ln{color:#999;padding-right:0.5em;border-right:1px solid #ccc;}
  114. </style>
  115. </head>
  116. <body>
  117. <?php
  118. /* @var array $e */
  119. /**
  120. * @param $file
  121. * @param $errorLine
  122. * @param $maxLines
  123. * @return string
  124. */
  125. function renderSourceCode($file, $errorLine, $maxLines)
  126. {
  127. $errorLine--;
  128. if ($errorLine < 0 || ($lines = @file($file)) === false || ($lineCount = count($lines)) <= $errorLine)
  129. return '';
  130. $halfLines = (int)($maxLines / 2);
  131. $beginLine = $errorLine - $halfLines > 0 ? $errorLine - $halfLines : 0;
  132. $endLine = $errorLine + $halfLines < $lineCount ? $errorLine + $halfLines : $lineCount - 1;
  133. $lineNumberWidth = strlen($endLine + 1);
  134. $output = '';
  135. for ($i = $beginLine; $i <= $endLine; ++$i) {
  136. $isErrorLine = $i === $errorLine;
  137. $code = sprintf("<span class = \"ln" . ($isErrorLine ? ' error-ln' : '') . "\">%0{$lineNumberWidth}d</span> %s", $i + 1, htmlspecialchars(str_replace("\t", ' ', $lines[$i])));
  138. if (!$isErrorLine)
  139. $output .= $code;
  140. else
  141. $output .= '<span class = "error">' . $code . '</span>';
  142. }
  143. return '
  144. <div class = "code">
  145. <pre>' . $output . '</pre>
  146. </div>
  147. ';
  148. }
  149. ?>
  150. <div class="errorBox">
  151. <b class="big">Hi,出错了!</b>
  152. <h1><?php echo strip_tags($e['message']); ?></h1>
  153. <div class="content">
  154. <?php if (!empty($e['file'])) : ?>
  155. <div class="info">
  156. <div class="title">
  157. 错误位置
  158. </div>
  159. <div class="text">
  160. <p><?php echo $e['file']; ?> &#12288;LINE: <?php echo $e['line']; ?></p>
  161. </div>
  162. </div>
  163. <?php
  164. $maxLines = 21;
  165. $file = $e["file"];
  166. $errorLine = $e["line"];
  167. echo renderSourceCode($file, $errorLine, $maxLines);
  168. endif; ?>
  169. <div class="info ">
  170. <div class="title">TRACE</div>
  171. <div class="text">
  172. <pre><?php debug_print_backtrace(); ?></pre>
  173. </div>
  174. </div>
  175. <div class="info">
  176. <div class="title">文件加载</div>
  177. <div class="text">
  178. <pre><?php echo implode("\n", get_included_files()); ?></pre>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. <div class="copyright">
  184. <p><a title="KXCMS" href="http://www.kxcms.com">KXcms FrameWork </a><sup><?php echo KX_VERSION ?></sup> { Fast & Simple & Light MVC PHP Framework }</p>
  185. </div>
  186. </body>
  187. </html>