在header(),是'Content-Type'= = = & # 39;内容类型# 39;就发送重复


In header(), is 'Content-Type' === 'Content-type' as far as sending duplicate/replacing headers is concerned?

在PHP中,文档说您可以通过第二个布尔参数header()替换先前设置的头。

我想知道:HTTP头是否大小写敏感或以任何方式规范化?

如果我使用:

    header('Content-Type: text/plain');
    header('Content-type: text/html');

…它会发送一个还是两个不同的报头?

同样,如果我使用:
    header('Content-Type: text/plain');
    header('Content-type: text/html', TRUE);

…它会(正确地)取代第一个吗?

根据RFC 2616, HTTP报头字段名是不区分大小写的。

PHP可以做到这一点,并将第一个头替换为第二个头。