diff --git a/library/think/response.php b/library/think/response.php index 4b209778..de569876 100644 --- a/library/think/response.php +++ b/library/think/response.php @@ -33,7 +33,7 @@ class Response 'text' => 'text/plain', ]; $type = strtolower($type); - if (isset($headers[$type])) { + if (!headers_sent() && isset($headers[$type])) { header('Content-Type:' . $headers[$type] . '; charset=utf-8'); }