一个关于本例header的问题
header("content-type:text/html; charset=utf-8"); 有什么用,什么意思
header("content-type:text/html; charset=utf-8"); 有什么用,什么意思
2015-04-29
请看这段话:
The purpose of the Content-Type field is to describe the data contained in the body fully enough that the receiving user agent can pick an appropriate agent or mechanism to present the data to the user, or otherwise deal with the data in an appropriate manner.
简单的说,Content-Type这个字段的作用就是:和客户端说返回的数据是什么类型的,便于客户端选择合适的方法处理数据。
楼主上面说的,“content-type:text/html; charset=utf-8”:意思就是告诉浏览器,这个是网页,编码是utf-8
参考:
http://www.w3.org/Protocols/rfc1341/4_Content-Type.html
举报