mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-03 05:52:48 +08:00
优化Response类的send方法 改进app_end的监听位置
This commit is contained in:
@@ -109,13 +109,14 @@ class App
|
||||
} catch (HttpResponseException $exception) {
|
||||
$data = $exception->getResponse();
|
||||
}
|
||||
// 输出数据到客户端
|
||||
|
||||
// 监听app_end
|
||||
APP_HOOK && Hook::listen('app_end', isset($data) ? $data : '');
|
||||
if (isset($data)) {
|
||||
// 输出数据到客户端
|
||||
if ($data instanceof Response) {
|
||||
return $data->send();
|
||||
} else {
|
||||
// 监听app_end
|
||||
APP_HOOK && Hook::listen('app_end', $data);
|
||||
$type = IS_AJAX ? Config::get('default_ajax_return') : Config::get('default_return_type');
|
||||
return Response::create($data, $type)->send();
|
||||
}
|
||||
|
||||
@@ -111,6 +111,10 @@ class Response
|
||||
}
|
||||
}
|
||||
echo $data;
|
||||
if (function_exists('fastcgi_finish_request')) {
|
||||
// 提高页面响应
|
||||
fastcgi_finish_request();
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user