I need to get the PHP content type for "security reasons." For example, if you used the header("Content-type: text/html; charset=utf-8") function header("Content-type: text/html; charset=utf-8") , how can I get the content type ( text/html ) and charset ( utf-8 ) separately in the future runtime?
My real problem is to know which encoding is used and only modify it if necessary, without having to redefine the Content-type . Those. if the content type is application/xml , save it, but only change the encoding.
Ref.
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
How is this possible?
source share