From 2e44f2a154e5e10ea41a59ec3b956c82800372cc Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 26 May 2016 14:13:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E7=A6=81=E7=94=A8=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E7=9A=84=E5=88=A4=E6=96=AD=20=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E5=9D=97=E4=B8=8D=E5=8F=97=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/library/think/App.php b/library/think/App.php index 7bb61231..a6205ff8 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -227,9 +227,20 @@ class App $module = strtolower($result[0] ?: $config['default_module']); // 获取模块名称 define('MODULE_NAME', strip_tags($module)); + $bind = Route::bind('module'); + $available = false; + if ($bind) { + // 绑定模块 + list($bindModule) = explode('/', $bind); + if (MODULE_NAME == $bindModule) { + $available = true; + } + } elseif (!in_array(MODULE_NAME, $config['deny_module_list']) && is_dir(APP_PATH . MODULE_NAME)) { + $available = true; + } // 模块初始化 - if (MODULE_NAME && !in_array(MODULE_NAME, $config['deny_module_list']) && is_dir(APP_PATH . MODULE_NAME)) { + if (MODULE_NAME && $available) { define('MODULE_PATH', APP_PATH . MODULE_NAME . DS); define('VIEW_PATH', MODULE_PATH . VIEW_LAYER . DS); // 初始化模块