mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
路由闭包改进 直接返回 [ module,controller, action ] 数组可以劫持路由 否则需要自己exit
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user