路由闭包改进 直接返回 [ module,controller, action ] 数组可以劫持路由 否则需要自己exit

This commit is contained in:
thinkphp
2015-12-02 00:00:21 +08:00
parent 2694a640ff
commit f475be3516

View File

@@ -273,9 +273,7 @@ class Route
// 正则路由
if ($route instanceof \Closure) {
// 执行闭包
$result = self::invokeRegx($route, $matches);
// 如果返回布尔值 则继续执行
return is_bool($result) ? $result : exit;
return self::invokeRegx($route, $matches);
}
return self::parseRegex($matches, $route, $regx);
}
@@ -299,9 +297,7 @@ class Route
if (false !== $match = self::match($regx, $rule)) {
if ($route instanceof \Closure) {
// 执行闭包
$result = self::invokeRule($route, $match);
// 如果返回布尔值 则继续执行
return is_bool($result) ? $result : exit;
return self::invokeRule($route, $match);
}
return self::parseRule($rule, $route, $regx);
}