From 75f855757b06030263c9f1df73eb4b740214585c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 24 Jun 2016 14:59:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BApp=E7=9A=84=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/think/App.php b/library/think/App.php index 0bc19a86..e2632e68 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -240,6 +240,7 @@ class App if (is_string($result)) { $result = explode('/', $result); } + $request = Request::instance(); if ($config['app_multi_module']) { // 多模块部署 $module = strip_tags(strtolower($result[0] ?: $config['default_module'])); @@ -258,6 +259,7 @@ class App // 模块初始化 if ($module && $available) { // 初始化模块 + $request->module($module); $config = self::init($module); } else { throw new HttpException(404, 'module not exists:' . $module); @@ -265,6 +267,7 @@ class App } else { // 单一模块部署 $module = ''; + $request->module($module); } // 当前模块路径 App::$modulePath = APP_PATH . ($module ? $module . DS : ''); @@ -285,9 +288,8 @@ class App throw new \InvalidArgumentException('illegal controller name:' . $controller); } - // 设置当前请求的模块、控制器、操作 - $request = Request::instance(); - $request->module($module)->controller($controller)->action($actionName); + // 设置当前请求的控制器、操作 + $request->controller($controller)->action($actionName); // 监听module_init Hook::listen('module_init', $request);