From 3b9c814f3ced80a2a952cdf1ec898ed83c3f0532 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 14 Feb 2016 23:48:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BResponse=E7=B1=BB=E7=9A=84red?= =?UTF-8?q?irect=E6=96=B9=E6=B3=95=20Controller=E7=B1=BB=E7=9A=84=E5=89=8D?= =?UTF-8?q?=E7=BD=AE=E6=93=8D=E4=BD=9C=E5=AE=9A=E4=B9=89=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Controller.php | 6 ++++++ library/think/Response.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/library/think/Controller.php b/library/think/Controller.php index ba01953a..ba892cbe 100644 --- a/library/think/Controller.php +++ b/library/think/Controller.php @@ -56,10 +56,16 @@ class Controller protected function beforeAction($method, $options = []) { if (isset($options['only'])) { + if (is_string($options['only'])) { + $options['only'] = explode(',', $options['only']); + } if (!in_array(ACTION_NAME, $options['only'])) { return; } } elseif (isset($options['except'])) { + if (is_string($options['except'])) { + $options['except'] = explode(',', $options['except']); + } if (in_array(ACTION_NAME, $options['except'])) { return; } diff --git a/library/think/Response.php b/library/think/Response.php index 95e53e4b..87a1bcbf 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -230,7 +230,7 @@ class Response public static function redirect($url, $params = []) { $http_response_code = 301; - if (in_array($params, [301, 302])) { + if (is_int($params) && in_array($params, [301, 302])) { $http_response_code = $params; $params = []; }