Browse Source

Merge branch 'master' of http://code.istudy.wang/root/Qii

Jinhui Zhu 4 năm trước cách đây
mục cha
commit
e7cae88c1f
2 tập tin đã thay đổi với 16 bổ sung11 xóa
  1. 13 11
      src/Base/Request.php
  2. 3 0
      src/Request/Url/Base.php

+ 13 - 11
src/Base/Request.php

@@ -47,22 +47,24 @@ abstract class Request
         $rewriteRule = \Qii::getInstance()->appConfigure(\Qii\Config\Consts::APP_SITE_METHOD);
         $this->url = new \Qii\Request\Url($rewriteRule);
         $this->host = IS_CLI ? '' : $_SERVER['HTTP_HOST'];
-        $params = (array)$this->url->request->params();
-        if (count($params) > 0) $this->params = array_merge($this->params, $params);
-        $routeInfo = $this->url->request->getPathArgs();
-        $controller = $this->defaultController();
+        $params = (array)$this->url->getParams();
+        if(count($params) > 0) $this->params = array_merge($this->params, $params);
+        $routeInfo = (array)$this->url->getPathArgs();
+		$controller = $this->defaultController();
         $action = $this->defaultAction();
         //cli 模式处理
         if(IS_CLI) {
             $routeInfo = $this->url->request->getCliPathArgs();
         }
-        if (count($routeInfo) > 1) {
-            $action = array_pop($routeInfo);
-            $controller = join("\\", $routeInfo);
-        } else if (count($routeInfo) == 1 && !empty($routeInfo[0])) {
-            $controller = $routeInfo[0];
-        }
-        //处理url中的数据
+
+		if(count($routeInfo) > 1)
+		{
+			$action = array_pop($routeInfo);
+			$controller = join("\\", $routeInfo);
+		}
+		else if(count($routeInfo) == 1 && !empty($routeInfo[0])) {
+			$controller = $routeInfo[0];
+		}        //处理url中的数据
         if (ucwords($rewriteRule) == 'Short') {
             $this->setControllerName($controller);
             $this->setActionName($action);

+ 3 - 0
src/Request/Url/Base.php

@@ -282,11 +282,14 @@ abstract class Base
                     $args[$index] = $val;
                 }
             }
+            
+            $this->pathArgs = $args;
             if ($args && $key != '') {
                 return isset($args[$key]) ? $args[$key] : '';
             }
             return $args;
         }
+        return array();
     }
 
     public function getCliPathArgs() {