【发布时间】:2013-07-12 20:16:16
【问题描述】:
出于“安全原因”,我需要获取 PHP 的内容类型。例如,如果你使用了函数header("Content-type: text/html; charset=utf-8"),那么在未来的执行时间,我如何可以分别接收到内容类型(text/html)和字符集(utf-8)?
我真正的问题是知道正在使用哪个字符集并仅在必要时对其进行修改,而无需重新定义信息Content-type。即如果内容类型为application/xml,则保留它,但更改only 字符集。
例如
Original: Content-type: text/html
First: -> set to application/xml.
Content-type: application/xml
Second: -> set charset.
Content-type: application/xml; charset=utf-8
Third: -> set to text/html
Content-type: text/html; charset=utf-8
这怎么可能?
【问题讨论】:
-
你要抓
Accept标头
标签: php http header content-type