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
請看這段話:
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