From fff423a5eb2475f28757aeb278d76016840fd4c6 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 13 Oct 2016 12:31:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Route=E7=B1=BBcheckRouteAlias?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index ca97e505..4b588b5e 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -944,18 +944,12 @@ class Route if (is_array($item)) { list($rule, $option) = $item; $action = $array[0]; - if (isset($option['allow'])) { + if (isset($option['allow']) && !in_array($action, explode(',', $option['allow']))) { // 允许操作 - $allow = is_string($option['allow']) ? explode(',', $option['allow']) : $option['allow']; - if (!in_array($action, $allow)) { - return false; - } - } elseif (isset($option['except'])) { + return false; + } elseif (isset($option['except']) && in_array($action, explode(',', $option['except']))) { // 排除操作 - $except = is_string($option['except']) ? explode(',', $option['except']) : $option['except']; - if (in_array($action, $except)) { - return false; - } + return false; } if (isset($option['method'][$action])) { $option['method'] = $option['method'][$action]; @@ -971,7 +965,7 @@ class Route } elseif (0 === strpos($rule, '\\')) { // 路由到类 return self::bindToClass($bind, substr($rule, 1), $depr); - } elseif (0 === strpos($url, '@')) { + } elseif (0 === strpos($rule, '@')) { // 路由到控制器类 return self::bindToController($bind, substr($rule, 1), $depr); } else {