From ebc862e5fbe1fc09f80f98ec168a297b6e8a9ce4 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 23 Jun 2016 17:49:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BRoute=E7=B1=BB=E5=8F=AF?= =?UTF-8?q?=E9=80=89=E5=8F=82=E6=95=B0=E7=9A=84=E5=AE=8C=E6=95=B4=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index dbb9cd64..b484a4f7 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -210,8 +210,8 @@ class Route */ public static function rule($rule, $route = '', $type = '*', $option = [], $pattern = [], $group = '') { - $group = $group ?: self::$group; - $type = strtoupper($type); + $group = $group ?: self::$group; + $type = strtoupper($type); if (strpos($type, '|')) { foreach (explode('|', $type) as $val) { self::rule($rule, $route, $val, $option, $pattern, $group); @@ -522,7 +522,7 @@ class Route /** * 检测子域名部署 * @access public - * @param Request $request Request请求对象 + * @param Request $request Request请求对象 * @return void */ public static function checkDomain($request) @@ -910,7 +910,7 @@ class Route if ($len1 >= $len2 || strpos($rule, '[')) { if ('$' == substr($rule, -1, 1)) { // 完整匹配 - if (!$merge && $len1 != $len2 && false === strpos($rule, '[')) { + if (!$merge && $len1 != $len2 && (false === strpos($rule, '[') || $len1 > $len2 || $len1 < $len2 - substr_count($rule, '['))) { return false; } else { $rule = substr($rule, 0, -1); @@ -924,12 +924,12 @@ class Route if ($option['after_behavior'] instanceof \Closure) { $result = call_user_func_array($option['after_behavior'], [$route]); } else { - foreach((array)$option['after_behavior'] as $behavior){ + foreach ((array) $option['after_behavior'] as $behavior) { $result = Hook::exec($behavior, '', $route); if (!is_null($result)) { break; } - } + } } // 路由规则重定向 if ($result instanceof Response) {