闭包路由定义的时候 函数返回值 如果是数组之外的 都会直接输出并exit

This commit is contained in:
thinkphp
2015-12-02 16:45:54 +08:00
parent 0dc82f3ab0
commit 59f71a86bb
3 changed files with 7 additions and 9 deletions

View File

@@ -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);
}