From 2105b00126d5c5a11659e62f274d7c92ba61ca08 Mon Sep 17 00:00:00 2001 From: huangdijia Date: Wed, 23 Dec 2015 11:04:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96Response::isExit()=E3=80=81Re?= =?UTF-8?q?sponse::success()=E3=80=81Response::error()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/response.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/library/think/response.php b/library/think/response.php index 8c252fcb..cba81750 100644 --- a/library/think/response.php +++ b/library/think/response.php @@ -70,14 +70,9 @@ class Response } } - if ($return) { - return $data; - } else { - echo $data; - } - if (self::$isExit) { - exit; - } + if ($return) return $data; + echo $data; + self::isExit() && exit(); } /** @@ -119,9 +114,10 @@ class Response * @param bool $exit 是否退出 * @return void */ - public static function isExit($exit = false) + public static function isExit($exit = null) { - self::$isExit = $exit; + if(is_null($exit)) return self::$isExit; + self::$isExit = (boolean) $exit; } /** @@ -175,6 +171,8 @@ class Response if ($type) { self::$type = $type; } + self::$isExit = true; + self::send(); } /** @@ -204,6 +202,8 @@ class Response if ($type) { self::$type = $type; } + self::$isExit = true; + self::send(); } /**