From 9d5728c67f72194047cb1eabd619255af583d095 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 17 May 2016 12:11:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96Response=E7=B1=BB=E7=9A=84sen?= =?UTF-8?q?d=E6=96=B9=E6=B3=95=20=E6=94=B9=E8=BF=9Bapp=5Fend=E7=9A=84?= =?UTF-8?q?=E7=9B=91=E5=90=AC=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 7 ++++--- library/think/Response.php | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) 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; }