出于“安全原因”,我需要获取 PHP 的内容类型。例如,如果您使用了函数header("Content-type: text/html; charset=utf-8"),那么在将来的执行时,我如何可以分别接收内容类型(text/html)和字符集(utf-8)?
我真正的问题是知道正在使用哪个字符集,并在必要时只修改它,而不必重新定义信息Content-type。即如果内容类型是application/xml,保留它,但改变唯一的字符集。
前任。
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
怎么可能?