Kaynağa Gözat

Update:FileNotFound path

Zhu Jinhui 6 yıl önce
ebeveyn
işleme
bdbb75fe46

+ 2 - 2
src/Application.php

@@ -175,7 +175,7 @@ class Application
             $ini,
             $env
         )
-        ) throw new \Qii\Exceptions\FileNotFound(\Qii::i(1405, $ini), 404);
+        ) throw new \Qii\Exceptions\FileNotFound($ini, 404);
         //载入request方法
         $this->request = Psr4::getInstance()->loadClass('\Qii\Request\Http');
         Setting::getInstance()->setDefaultTimeZone();
@@ -366,7 +366,7 @@ class Application
             Psr4::getInstance()->getFileByPrefix($ini),
             $env)
         ) {
-            throw new \Qii\Exceptions\FileNotFound(\Qii::i(1405, $ini), 404);
+            throw new \Qii\Exceptions\FileNotFound($ini, 404);
         }
         return $this;
     }

+ 2 - 2
src/Autoloader/Import.php

@@ -50,7 +50,7 @@ class Import
             return $configure;
         }else{
             //print_r(debug_backtrace());
-            throw new \Qii\Exceptions\FileNotFound(\Qii::i(1405, $file), 404);
+            throw new \Qii\Exceptions\FileNotFound($file, 404);
         }
         return false;
     }
@@ -74,7 +74,7 @@ class Import
      */
     public static function requireByDir($dir)
     {
-        if (!is_dir($dir)) throw new \Qii\Exceptions\FileNotFound(\Qii::i(1405, $dir), 404);
+        if (!is_dir($dir)) throw new \Qii\Exceptions\FileNotFound($dir, 404);
         $files = self::findFiles($dir, array('php'));
         if (isset($files['php'])) self::requires($files['php']);
     }

+ 1 - 1
src/Autoloader/Psr4.php

@@ -277,7 +277,7 @@ class Psr4
         if(!$this->searchMappedFile($class))
         {
             $notLoaded = isset(self::$lastErrorLoadedFile[$class]) ? self::$lastErrorLoadedFile[$class] : self::getClassName($class);
-            throw new \Qii\Exceptions\FileNotFound(\Qii::i(1405, $notLoaded), 404);
+            throw new \Qii\Exceptions\FileNotFound($notLoaded, 404);
         }
     }
 

+ 2 - 4
src/Exceptions/FileNotFound.php

@@ -7,10 +7,8 @@ class FileNotFound extends Errors
 
 	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);
-        }
+        $message = self::getRelatePath($_SERVER['SCRIPT_FILENAME'], $message);
+        $message = \Qii::i(1405, $message);
         parent::__construct($message, $code, $previous);
     }
 

+ 1 - 1
src/Language/Loader.php

@@ -70,7 +70,7 @@ class Loader
 		if (is_file($fileName)) {
 			return $this->merge($fileName);
 		}
-		throw new \Qii\Exceptions\FileNotFound(\Qii::i(1405, $fileName), 404);
+		throw new \Qii\Exceptions\FileNotFound($fileName, 404);
 	}
 
 	/**