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); // 记录匹配的路由信息