Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

94 lines
2.0KB

  1. <?php
  2. /* @var $exception \yii\web\HttpException|\Exception */
  3. /* @var $handler \yii\web\ErrorHandler */
  4. if ($exception instanceof \yii\web\HttpException) {
  5. $code = $exception->statusCode;
  6. } else {
  7. $code = $exception->getCode();
  8. }
  9. $name = $handler->getExceptionName($exception);
  10. if ($name === null) {
  11. $name = 'Error';
  12. }
  13. if ($code) {
  14. $name .= " (#$code)";
  15. }
  16. if ($exception instanceof \yii\base\UserException) {
  17. $message = $exception->getMessage();
  18. } else {
  19. $message = 'An internal server error occurred.';
  20. }
  21. if (method_exists($this, 'beginPage')) {
  22. $this->beginPage();
  23. }
  24. ?>
  25. <!DOCTYPE html>
  26. <html>
  27. <head>
  28. <meta charset="utf-8" />
  29. <title><?= $handler->htmlEncode($name) ?></title>
  30. <style>
  31. body {
  32. font: normal 9pt "Verdana";
  33. color: #000;
  34. background: #fff;
  35. }
  36. h1 {
  37. font: normal 18pt "Verdana";
  38. color: #f00;
  39. margin-bottom: .5em;
  40. }
  41. h2 {
  42. font: normal 14pt "Verdana";
  43. color: #800000;
  44. margin-bottom: .5em;
  45. }
  46. h3 {
  47. font: bold 11pt "Verdana";
  48. }
  49. p {
  50. font: normal 9pt "Verdana";
  51. color: #000;
  52. }
  53. .version {
  54. color: gray;
  55. font-size: 8pt;
  56. border-top: 1px solid #aaa;
  57. padding-top: 1em;
  58. margin-bottom: 1em;
  59. }
  60. </style>
  61. </head>
  62. <body>
  63. <h1><?= $handler->htmlEncode($name) ?></h1>
  64. <h2><?= nl2br($handler->htmlEncode($message)) ?></h2>
  65. <p>
  66. The above error occurred while the Web server was processing your request.
  67. </p>
  68. <p>
  69. Please contact us if you think this is a server error. Thank you.
  70. </p>
  71. <div class="version">
  72. <?= date('Y-m-d H:i:s', time()) ?>
  73. </div>
  74. <?php
  75. if (method_exists($this, 'endBody')) {
  76. $this->endBody(); // to allow injecting code into body (mostly by Yii Debug Toolbar)
  77. }
  78. ?>
  79. </body>
  80. </html>
  81. <?php
  82. if (method_exists($this, 'endPage')) {
  83. $this->endPage();
  84. }