mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
改进路由到类的方法的地址写法
This commit is contained in:
@@ -1041,7 +1041,8 @@ class Route
|
||||
$result = ['type' => 'redirect', 'url' => $url, 'status' => (is_array($route) && isset($route[1])) ? $route[1] : 301];
|
||||
} elseif (0 === strpos($url, '\\')) {
|
||||
// 路由到方法
|
||||
$result = ['type' => 'method', 'method' => is_array($route) ? [$url, $route[1]] : $url, 'params' => $matches];
|
||||
$method = strpos($url, '@') ? explode('@', $url) : $url;
|
||||
$result = ['type' => 'method', 'method' => $method, 'params' => $matches];
|
||||
} elseif (0 === strpos($url, '@')) {
|
||||
// 路由到控制器
|
||||
$result = ['type' => 'controller', 'controller' => substr($url, 1), 'params' => $matches];
|
||||
|
||||
@@ -145,6 +145,7 @@ class Handle
|
||||
// 不显示详细错误信息
|
||||
$data['message'] = Config::get('error_message');
|
||||
}
|
||||
|
||||
//保留一层
|
||||
while (ob_get_level() > 1) {
|
||||
ob_end_clean();
|
||||
@@ -154,8 +155,7 @@ class Handle
|
||||
extract($data);
|
||||
include Config::get('exception_tmpl');
|
||||
// 获取并清空缓存
|
||||
$content = ob_get_clean();
|
||||
|
||||
$content = ob_get_clean();
|
||||
$response = new Response($content, 'html');
|
||||
|
||||
if ($exception instanceof HttpException) {
|
||||
@@ -167,7 +167,6 @@ class Handle
|
||||
$statusCode = 500;
|
||||
}
|
||||
$response->code($statusCode);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user