Преглед на файлове

文件未找到的提示中替换跟路径

Zhu Jinhui преди 6 години
родител
ревизия
9d4faab5c2
променени са 1 файла, в които са добавени 10 реда и са изтрити 1 реда
  1. 10 1
      src/Exceptions/FileNotFound.php

+ 10 - 1
src/Exceptions/FileNotFound.php

@@ -5,7 +5,16 @@ class FileNotFound extends Errors
 {
 	const VERSION = '1.2';
 
-	/**
+	public function __construct($message, $code, $previous = null)
+    {
+        if($code == 404) {
+            $documentRoot = str_replace(array('/', '\\'), array(DS, DS), $_SERVER['DOCUMENT_ROOT']);
+            $message = str_replace($documentRoot, '', $message);
+        }
+        parent::__construct($message, $code, $previous);
+    }
+
+    /**
 	 * 显示错误
 	 *
 	 * @param Object $e Exception