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