修复header已发送仍调用header函数的notice

This commit is contained in:
Haotong Lin
2015-12-17 12:13:24 +08:00
parent 82399867c0
commit 627fb9b529

View File

@@ -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');
}