diff --git a/library/think/App.php b/library/think/App.php index 8f53688a..2760b88a 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -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(); } diff --git a/library/think/Response.php b/library/think/Response.php index 7ed9dde5..a0f4a5d1 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -111,6 +111,10 @@ class Response } } echo $data; + if (function_exists('fastcgi_finish_request')) { + // 提高页面响应 + fastcgi_finish_request(); + } return $data; }