天天看點

HTTP--content-type

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTTP--content-type</title>
</head>
<body>
    <script>
        /*
            HTTP--content-type
                Content-Type(内容類型),一般是指網頁中存在的 Content-Type,
                用于定義網絡檔案的類型和網頁的編碼,決定浏覽器将以什麼形式、什麼編碼讀取這個檔案,
                這就是經常看到一些 PHP 網頁點選的結果卻是下載下傳一個檔案或一張圖檔的原因。
                Content-Type 标頭告訴用戶端實際傳回的内容的内容類型。
        */
        /*
            1 常見的媒體格式類型如下:
                1.1 text/html : HTML格式
                1.2 ext/plain :純文字格式
                1.3 text/xml : XML格式
                1.4 image/gif :gif圖檔格式
                1.5 image/jpeg :jpg圖檔格式
                1.6 image/png:png圖檔格式


            2.以application開頭的媒體格式類型:
                2.1 application/xhtml+xml :XHTML格式
                2.2 application/xml: XML資料格式
                2.3 application/atom+xml :Atom XML聚合格式
                2.4 application/json: JSON資料格式
                2.5 application/pdf:pdf格式
                2.6 application/msword : Word文檔格式
                2.7 application/octet-stream : 二進制流資料(如常見的檔案下載下傳)
                2.8 application/x-www-form-urlencoded : <form encType=””>中預設的encType,form表單資料被編碼為key/value格式發送到伺服器(表單預設的送出資料的格式)


            3.另外一種常見的媒體格式是上傳檔案之時使用的:
                3.1 multipart/form-data : 需要在表單中進行檔案上傳時,就需要使用該格式
        */
    </script>
</body>
</html>      

  

HTTP--content-type