From 3e62fe152ff27cb55c8e1f622439d78f5f1b7969 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 23 Jun 2017 12:14:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0response=5Fstart=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E4=BD=8D=20=E8=B7=AF=E7=94=B1=E5=A2=9E=E5=8A=A0respon?= =?UTF-8?q?se=E6=96=B9=E6=B3=95=E7=94=A8=E4=BA=8E=E7=BB=91=E5=AE=9Arespons?= =?UTF-8?q?e=E5=A4=84=E7=90=86=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Response.php | 3 +++ library/think/Route.php | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/library/think/Response.php b/library/think/Response.php index 96737dcd..206144cd 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -92,6 +92,9 @@ class Response // 处理输出数据 $data = $this->getContent(); + // 监听response_start + Hook::listen('response_start', $this); + // Trace调试注入 if (Env::get('app_trace', Config::get('app_trace'))) { Debug::inject($this, $data); diff --git a/library/think/Route.php b/library/think/Route.php index a5b19327..36ab0980 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -1449,6 +1449,10 @@ class Route $request->bind($bind); } + if (!empty($option['response'])) { + Hook::add('response_start', $option['response']); + } + // 解析额外参数 self::parseUrlParams(empty($paths) ? '' : implode('|', $paths), $matches); // 记录匹配的路由信息