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.
2015-05-05
請(qǐng)看這段話:
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.
簡(jiǎn)單的說,Content-Type這個(gè)字段的作用就是:和客戶端說返回的數(shù)據(jù)是什么類型的,便于客戶端選擇合適的方法處理數(shù)據(jù)。
樓主上面說的,“content-type:text/html; charset=utf-8”:意思就是告訴瀏覽器,這個(gè)是網(wǎng)頁,編碼是utf-8
參考:
http://www.w3.org/Protocols/rfc1341/4_Content-Type.html