zjh 4 тижнів тому
батько
коміт
bf5ae27400
1 змінених файлів з 18 додано та 18 видалено
  1. 18 18
      src/Request/Url/Base.php

+ 18 - 18
src/Request/Url/Base.php

@@ -39,17 +39,17 @@ abstract class Base
      * URL中匹配到的参数
      */
     private $params = null;
-	
-	/**
-	 * 文件扩展名
-	 */
-	private $sysfileExtension;
-	/**
-	 * 存储路径字段
-	 */
-	private $pathArgs;
 
-	public $host;
+    /**
+     * 文件扩展名
+     */
+    private $sysfileExtension;
+    /**
+     * 存储路径字段
+     */
+    private $pathArgs;
+
+    public $host;
 
     /**
      * 初始化模式
@@ -164,7 +164,7 @@ abstract class Base
      */
     public function getPathInfo($path = '', $index = 'dirname')
     {
-        if (empty($path)) $path = $_SERVER['SCRIPT_NAME'];
+        if (empty($path)) $path = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '';
         //Array ( [dirname] => /Qii [basename] => index.php [extension] => php [filename] => index )
         $pathInfo = pathinfo($path);
         $pathInfo['dirname'] = str_replace("\\", "/", $pathInfo['dirname']);
@@ -182,7 +182,7 @@ abstract class Base
     public function getPath($path = '')
     {
         if (empty($path)) {
-            $path = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '';
+            $path = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
         }
         return substr($path, 0, (strrpos($path, '/')));
     }
@@ -327,18 +327,18 @@ abstract class Base
         $paramArray = explode($this->_symbol, $query);
         $this->pathArgs = $v = $this->decodeArgs($paramArray);
         //添加系统扩展名到返回数组中 2011-10-14 15:26
-		$this->sysfileExtension = $extension[2] ?? '';
+        $this->sysfileExtension = $extension[2] ?? '';
         if ($_GET) $v = array_merge($v, $_GET);
         if ($key != '' || is_int($key)) {
             return $v[$key];
         }
         return $v;
     }
-	
-	public function getPathArgs()
-	{
-		return $this->pathArgs;
-	}
+
+    public function getPathArgs()
+    {
+        return $this->pathArgs;
+    }
 
     /**
      * 对比转发文件的路径