From 0d497d4abb646662878ba95ac1335e0df4788228 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 10 May 2016 16:08:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BRoute=E7=B1=BB=E7=9A=84?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E5=8C=B9=E9=85=8D=E5=90=8E=E7=9A=84=E5=90=8E?= =?UTF-8?q?=E7=BD=AE=E8=A1=8C=E4=B8=BA=20=E5=85=81=E8=AE=B8=E5=8D=95?= =?UTF-8?q?=E7=8B=AC=E6=89=A7=E8=A1=8C=E8=BE=93=E5=87=BA=20=E5=B9=B6?= =?UTF-8?q?=E5=BA=9F=E9=99=A4=20response=5Fauto=5Foutput=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- convention.php | 8 +++----- library/think/App.php | 5 ++++- library/think/Route.php | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/convention.php b/convention.php index 78b731d7..86f205c1 100644 --- a/convention.php +++ b/convention.php @@ -31,8 +31,6 @@ return [ 'lang_switch_on' => false, // 默认全局过滤方法 用逗号分隔多个 'default_filter' => '', - // 自动Response输出 - 'response_auto_output' => true, // 是否启用控制器类后缀 'use_controller_suffix' => false, @@ -214,9 +212,9 @@ return [ 'slave_no' => '', ], //分页配置 - 'paginate' => [ + 'paginate' => [ 'type' => 'bootstrap', - 'var_page' => 'page' - ] + 'var_page' => 'page', + ], ]; diff --git a/library/think/App.php b/library/think/App.php index 242c6c87..9d5db618 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -94,13 +94,16 @@ class App // 规则闭包 $data = self::invokeFunction($dispatch['function'], $dispatch['params']); break; + case 'finish': + // 已经完成 不再继续执行 + break; default: throw new Exception('dispatch type not support', 10008); } // 监听app_end APP_HOOK && Hook::listen('app_end', $data); // 输出数据到客户端 - if (Config::get('response_auto_output')) { + if (isset($data)) { // 自动响应输出 return Response::send($data, Response::type(), Config::get('response_return')); } diff --git a/library/think/Route.php b/library/think/Route.php index 0f2b3c3b..17505a98 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -525,7 +525,10 @@ class Route // 匹配到路由规则 // 检测是否定义路由 if (!empty($option['after_behavior'])) { - Hook::exec($option['after_behavior'], $route); + $result = Hook::exec($option['after_behavior'], $route); + if (false === $result) { + return ['type' => 'finish']; + } } if ($route instanceof \Closure) { // 执行闭包