From bc46e9ccca2ae76f1195f0a53640e92c8aaa21f3 Mon Sep 17 00:00:00 2001 From: huangdijia Date: Fri, 4 Dec 2015 11:21:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E4=BC=98=E5=85=88=E5=9F=9F=E5=90=8D=E8=A7=A3=E6=9E=90=E4=BA=8E?= =?UTF-8?q?pathinfo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/app.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/think/app.php b/library/think/app.php index dfb01352..316b1558 100644 --- a/library/think/app.php +++ b/library/think/app.php @@ -232,6 +232,9 @@ class App if (!IS_CLI && !empty($config['domain_deploy'])) { if ($match = Route::checkDomain($config['domain_rules'])) { $result = $match; + (!defined('BIND_MODULE') && !empty($result[0])) && define('BIND_MODULE', $result[0]); + (!defined('BIND_CONTROLLER') && !empty($result[1])) && define('BIND_CONTROLLER', $result[1]); + (!defined('BIND_ACTION') && !empty($result[2])) && define('BIND_ACTION', $result[2]); } } @@ -316,9 +319,11 @@ class App } // 获取控制器名 - define('CONTROLLER_NAME', strip_tags(strtolower($result[1] ?: $config['default_controller']))); + $controller = strip_tags(strtolower($result[1] ?: $config['default_controller'])); + define('CONTROLLER_NAME', defined('BIND_CONTROLLER') ? BIND_CONTROLLER : $controller); // 获取操作名 - define('ACTION_NAME', strip_tags(strtolower($result[2] ?: $config['default_action']))); + $action = strip_tags(strtolower($result[2] ?: $config['default_action'])); + define('ACTION_NAME', defined('BIND_ACTION') ? BIND_ACTION : $action); } }