From 562ca61ef6d8bc2b7f40d962435ebb4355028da5 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 24 Dec 2015 17:12:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=A3=80=E6=B5=8B=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=A1=8C=E4=B8=BA=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/route.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/library/think/route.php b/library/think/route.php index 2526f8e4..fd22cbe1 100644 --- a/library/think/route.php +++ b/library/think/route.php @@ -261,10 +261,13 @@ class Route continue; } // 自定义检测 - if (!empty($option['callback']) && is_callable($option['callback'])) { - if (false === call_user_func($option['callback'])) { - continue; - } + if (!empty($option['callback']) && is_callable($option['callback']) && false === call_user_func($option['callback'])) { + continue; + } + + // 行为检测 + if (!empty($option['behavior']) && false === \think\hook::exec($option['behavior'])) { + continue; } if (!empty($val['routes'])) { @@ -311,7 +314,7 @@ class Route $rule = array_shift($val); } // 单项路由 - $route = !empty($val['route'])?$val['route']:''; + $route = !empty($val['route']) ? $val['route'] : ''; if (0 === strpos($rule, '/') && preg_match($rule, $url, $matches)) { return self::checkRegex($route, $url, $matches); } else {