mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-05 22:52:49 +08:00
闭包路由定义的时候 函数返回值 如果是数组之外的 都会直接输出并exit
This commit is contained in:
@@ -273,7 +273,8 @@ class Route
|
||||
// 正则路由
|
||||
if ($route instanceof \Closure) {
|
||||
// 执行闭包
|
||||
return self::invokeRegx($route, $matches);
|
||||
$result = self::invokeRegx($route, $matches);
|
||||
return is_array($result) ? $result : exit($result);
|
||||
}
|
||||
return self::parseRegex($matches, $route, $regx);
|
||||
}
|
||||
@@ -297,7 +298,8 @@ class Route
|
||||
if (false !== $match = self::match($regx, $rule)) {
|
||||
if ($route instanceof \Closure) {
|
||||
// 执行闭包
|
||||
return self::invokeRule($route, $match);
|
||||
$result = self::invokeRule($route, $match);
|
||||
return is_array($result) ? $result : exit($result);
|
||||
}
|
||||
return self::parseRule($rule, $route, $regx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user