Bläddra i källkod

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

Zhu Jinhui 6 år sedan
förälder
incheckning
9d4faab5c2
1 ändrade filer med 10 tillägg och 1 borttagningar
  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