From f52a7bf97880ee4d06a47953fd781aac7ce22dec Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 9 Sep 2016 18:25:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96Route=E7=B1=BB=E7=9A=84?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E4=BC=A0=E5=80=BC=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E4=BD=BF=E7=94=A8Request=E7=B1=BB=E7=9A=84param=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 11 +++++------ library/think/Route.php | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/library/think/App.php b/library/think/App.php index 4dfd68c8..d574e647 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -135,15 +135,15 @@ class App break; case 'controller': // 执行控制器操作 - $data = Loader::action($dispatch['controller'], $dispatch['params']); + $data = Loader::action($dispatch['controller']); break; case 'method': // 执行回调方法 - $data = self::invokeMethod($dispatch['method'], $dispatch['params']); + $data = self::invokeMethod($dispatch['method']); break; case 'function': // 执行闭包 - $data = self::invokeFunction($dispatch['function'], $dispatch['params']); + $data = self::invokeFunction($dispatch['function']); break; case 'response': $data = $dispatch['response']; @@ -181,12 +181,11 @@ class App * @access public * @param array|string $dispatch 调度信息 * @param string $type 调度类型 - * @param array $params 参数 * @return void */ - public static function dispatch($dispatch, $type = 'module', $params = []) + public static function dispatch($dispatch, $type = 'module') { - self::$dispatch = ['type' => $type, $type => $dispatch, 'params' => $params]; + self::$dispatch = ['type' => $type, $type => $dispatch]; } /** diff --git a/library/think/Route.php b/library/think/Route.php index 62cb4790..9665ecfb 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -1346,7 +1346,7 @@ class Route } // 路由规则重定向 if ($result instanceof Response) { - return ['type' => 'response', 'response' => $result, 'params' => $matches]; + return ['type' => 'response', 'response' => $result]; } elseif (is_array($result)) { return $result; } @@ -1354,17 +1354,17 @@ class Route if ($route instanceof \Closure) { // 执行闭包 - $result = ['type' => 'function', 'function' => $route, 'params' => $matches]; + $result = ['type' => 'function', 'function' => $route]; } elseif (0 === strpos($route, '/') || 0 === strpos($route, 'http')) { // 路由到重定向地址 $result = ['type' => 'redirect', 'url' => $route, 'status' => isset($option['status']) ? $option['status'] : 301]; } elseif (0 === strpos($route, '\\')) { // 路由到方法 $method = strpos($route, '@') ? explode('@', $route) : $route; - $result = ['type' => 'method', 'method' => $method, 'params' => $matches]; + $result = ['type' => 'method', 'method' => $method]; } elseif (0 === strpos($route, '@')) { // 路由到控制器 - $result = ['type' => 'controller', 'controller' => substr($route, 1), 'params' => $matches]; + $result = ['type' => 'controller', 'controller' => substr($route, 1)]; } else { // 路由到模块/控制器/操作 $result = self::parseModule($route);