diff --git a/helper.php b/helper.php index 6ce323db..0c6dc504 100644 --- a/helper.php +++ b/helper.php @@ -428,6 +428,5 @@ function xml($data = [], $code = 200, $options = []) */ function redirect($url = [], $code = 200, $params = []) { - $response = Response::create($url, 'redirect')->code($code)->params($params); - throw new HttpResponseException($response); + return Response::create($url, 'redirect')->code($code)->params($params); } diff --git a/library/think/App.php b/library/think/App.php index e463c1d5..8f53688a 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -82,7 +82,7 @@ class App switch ($dispatch['type']) { case 'redirect': // 执行重定向跳转 - header('Location: ' . $dispatch['url'], true, $dispatch['status']); + $data = Response::create($dispatch['url'], 'redirect')->code($dispatch['status']); break; case 'module': // 模块/控制器/操作