Pārlūkot izejas kodu

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

Zhu Jinhui 6 gadi atpakaļ
vecāks
revīzija
9d4faab5c2
1 mainītis faili ar 10 papildinājumiem un 1 dzēšanām
  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