{"id":57,"date":"2025-11-20T16:52:24","date_gmt":"2025-11-20T08:52:24","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=57"},"modified":"2025-11-20T16:52:24","modified_gmt":"2025-11-20T08:52:24","slug":"http%e4%b8%ad%e7%9a%84content-type%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2025\/11\/20\/http%e4%b8%ad%e7%9a%84content-type%e8%af%a6%e8%a7%a3\/","title":{"rendered":"HTTP\u4e2d\u7684Content-type\u8be6\u89e3"},"content":{"rendered":"\n<p>\u5728 HTTP \u534f\u8bae\u4e2d\uff0c<code>Content-Type<\/code>&nbsp;\u5934\u90e8\u5b57\u6bb5\u7528\u4e8e\u544a\u77e5\u63a5\u6536\u65b9\uff0c\u53d1\u9001\u7684\u5b9e\u4f53\u5185\u5bb9\uff08\u8bf7\u6c42\u6216\u54cd\u5e94\u4f53\uff09\u662f\u4f55\u79cd\u7c7b\u578b\u3002\u5b83\u901a\u5e38\u5305\u542b\u5a92\u4f53\u7c7b\u578b\uff08\u5373 MIME \u7c7b\u578b\uff09\uff0c\u6709\u65f6\u4e5f\u5305\u62ec\u5b50\u7c7b\u578b\u548c\u9644\u52a0\u53c2\u6570\u3002<code>Content-Type<\/code>&nbsp;\u5934\u90e8\u662f\u544a\u8bc9\u63a5\u6536\u65b9\u5982\u4f55\u89e3\u6790\u8bf7\u6c42\u6216\u54cd\u5e94\u4f53\u6570\u636e\u7684\u5173\u952e\u90e8\u5206\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.&nbsp;<strong>Content-Type \u7684\u7ed3\u6784<\/strong><\/h3>\n\n\n\n<p><code>Content-Type<\/code>&nbsp;\u7684\u57fa\u672c\u683c\u5f0f\u4e3a\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nContent-Type: type\/subtype; parameter=value\n\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><strong>type<\/strong>\uff1a\u5a92\u4f53\u7c7b\u578b\uff0c\u6307\u5b9a\u5185\u5bb9\u7684\u57fa\u672c\u7c7b\u578b\uff08\u4f8b\u5982\uff0c<code>text<\/code>,\u00a0<code>application<\/code>,\u00a0<code>image<\/code>\u00a0\u7b49\uff09\u3002<\/li>\n\n\n\n<li><strong>subtype<\/strong>\uff1a\u5a92\u4f53\u5b50\u7c7b\u578b\uff0c\u6307\u5b9a\u5185\u5bb9\u7684\u5177\u4f53\u683c\u5f0f\u6216\u7f16\u7801\uff08\u4f8b\u5982\uff0c<code>plain<\/code>,\u00a0<code>html<\/code>,\u00a0<code>json<\/code>,\u00a0<code>xml<\/code>\u00a0\u7b49\uff09\u3002<\/li>\n\n\n\n<li><strong>parameter<\/strong>\uff1a\u53ef\u9009\u7684\u9644\u52a0\u53c2\u6570\uff0c\u7528\u4e8e\u8fdb\u4e00\u6b65\u8bf4\u660e\u5a92\u4f53\u7c7b\u578b\u7684\u7ec6\u8282\uff08\u5982\u5b57\u7b26\u7f16\u7801\u3001\u538b\u7f29\u65b9\u5f0f\u7b49\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2.&nbsp;<strong>\u5e38\u89c1\u7684 Content-Type \u7c7b\u578b\u53ca\u5176\u7528\u9014<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">1.&nbsp;<strong>\u6587\u672c\u7c7b\u578b\uff08<code>text\/*<\/code>\uff09<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>Content-Type: text\/plain<\/code><\/strong><br>\u7eaf\u6587\u672c\u683c\u5f0f\uff0c\u65e0\u683c\u5f0f\u7684\u6587\u672c\u6570\u636e\uff0c\u901a\u5e38\u7528\u4e8e\u65e0\u4efb\u4f55\u6837\u5f0f\u548c\u6807\u8bb0\u7684\u6587\u672c\u5185\u5bb9\uff08\u5982\u666e\u901a\u7684\u00a0<code>.txt<\/code>\u00a0\u6587\u4ef6\uff09\u3002<code>Content-Type: text\/plain<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: text\/html<\/code><\/strong><br>HTML \u683c\u5f0f\uff0c\u6307\u793a\u5185\u5bb9\u662f HTML \u6587\u6863\uff0c\u6d4f\u89c8\u5668\u4f1a\u6309 HTML \u683c\u5f0f\u6e32\u67d3\u5185\u5bb9\u3002<code>Content-Type: text\/html<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: text\/css<\/code><\/strong><br>CSS \u6587\u4ef6\uff0c\u7528\u4e8e\u6837\u5f0f\u8868\u6587\u4ef6\uff0c\u6d4f\u89c8\u5668\u6839\u636e CSS \u89c4\u5219\u6e32\u67d3\u9875\u9762\u3002<code>Content-Type: text\/css<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: text\/javascript<\/code><\/strong><br>JavaScript \u6587\u4ef6\uff0c\u6307\u793a\u5185\u5bb9\u662f JavaScript \u4ee3\u7801\uff0c\u6d4f\u89c8\u5668\u4f1a\u6267\u884c\u8be5\u4ee3\u7801\u3002<code>Content-Type: text\/javascript<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: text\/xml<\/code><\/strong><br>XML \u6587\u4ef6\uff0c\u6307\u793a\u5185\u5bb9\u662f XML \u683c\u5f0f\u7684\u6570\u636e\uff0c\u901a\u5e38\u7528\u4e8e\u8868\u793a\u7ed3\u6784\u5316\u7684\u6570\u636e\u3002<code>Content-Type: text\/xml<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: text\/csv<\/code><\/strong><br>CSV \u6587\u4ef6\uff0c\u6307\u793a\u5185\u5bb9\u662f\u9017\u53f7\u5206\u9694\u503c\uff08CSV\uff09\u683c\u5f0f\u7684\u6587\u672c\u6570\u636e\u3002<code>Content-Type: text\/csv<\/code><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">2.&nbsp;<strong>\u5e94\u7528\u7c7b\u578b\uff08<code>application\/*<\/code>\uff09<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>Content-Type: application\/json<\/code><\/strong><br>JSON \u683c\u5f0f\uff0c\u6307\u793a\u5185\u5bb9\u662f JSON \u683c\u5f0f\u7684\u6570\u636e\uff0c\u5e38\u7528\u4e8e\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u4ea4\u6362\u6570\u636e\u3002<code>Content-Type: application\/json<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: application\/xml<\/code><\/strong><br>XML \u683c\u5f0f\uff0c\u6307\u793a\u5185\u5bb9\u662f XML \u683c\u5f0f\u7684\u6570\u636e\uff0c\u901a\u5e38\u7528\u4e8e\u6570\u636e\u4ea4\u6362\u6216 API \u54cd\u5e94\u3002<code>Content-Type: application\/xml<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: application\/x-www-form-urlencoded<\/code><\/strong><br>\u8868\u5355\u6570\u636e\u7684\u6807\u51c6\u7f16\u7801\u65b9\u5f0f\uff0c\u901a\u5e38\u7528\u4e8e\u63d0\u4ea4\u8868\u5355\u65f6\u3002\u5b57\u6bb5\u4e0e\u5b57\u6bb5\u4e4b\u95f4\u7531\u00a0<code>&amp;<\/code>\u00a0\u5206\u9694\uff0c\u6bcf\u4e2a\u5b57\u6bb5\u7684\u503c\u7531\u00a0<code>=<\/code>\u00a0\u8fde\u63a5\u3002<code>Content-Type: application\/x-www-form-urlencoded<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: application\/json<\/code><\/strong><br>JSON \u6570\u636e\uff0c\u5e38\u7528\u4e8e Web API \u7684\u8bf7\u6c42\u548c\u54cd\u5e94\u4f53\uff0c\u6570\u636e\u683c\u5f0f\u662f JSON\u3002<code>Content-Type: application\/json<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: application\/javascript<\/code><\/strong><br>JavaScript \u6587\u4ef6\uff0c\u6307\u793a\u5185\u5bb9\u662f JavaScript \u4ee3\u7801\uff0c\u6d4f\u89c8\u5668\u4f1a\u6267\u884c\u8be5\u4ee3\u7801\u3002<code>Content-Type: application\/javascript<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: application\/octet-stream<\/code><\/strong><br>\u901a\u7528\u7684\u4e8c\u8fdb\u5236\u6570\u636e\u6d41\uff0c\u901a\u5e38\u7528\u4e8e\u53d1\u9001\u6587\u4ef6\u5185\u5bb9\u3002\u5982\u679c\u670d\u52a1\u5668\u4e0d\u77e5\u9053\u6587\u4ef6\u7c7b\u578b\uff0c\u53ef\u4ee5\u4f7f\u7528\u6b64\u7c7b\u578b\u3002<code>Content-Type: application\/octet-stream<\/code><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">3.&nbsp;<strong>\u56fe\u7247\u7c7b\u578b\uff08<code>image\/*<\/code>\uff09<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>Content-Type: image\/jpeg<\/code><\/strong><br>JPEG \u56fe\u50cf\u683c\u5f0f\u3002<code>Content-Type: image\/jpeg<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: image\/png<\/code><\/strong><br>PNG \u56fe\u50cf\u683c\u5f0f\u3002<code>Content-Type: image\/png<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: image\/gif<\/code><\/strong><br>GIF \u56fe\u50cf\u683c\u5f0f\u3002<code>Content-Type: image\/gif<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: image\/svg+xml<\/code><\/strong><br>SVG \u56fe\u50cf\u683c\u5f0f\uff0c\u901a\u5e38\u7528\u4e8e\u77e2\u91cf\u56fe\u5f62\u3002<code>Content-Type: image\/svg+xml<\/code><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">4.&nbsp;<strong>\u591a\u90e8\u5206\u8868\u5355\u6570\u636e\uff08<code>multipart\/*<\/code>\uff09<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>Content-Type: multipart\/form-data<\/code><\/strong><br>\u7528\u4e8e\u8868\u5355\u4e0a\u4f20\u6587\u4ef6\u65f6\uff0c\u5185\u5bb9\u6309\u591a\u90e8\u5206\u7f16\u7801\u65b9\u5f0f\u53d1\u9001\u3002\u6bcf\u4e2a\u90e8\u5206\u90fd\u662f\u5355\u72ec\u7684\u5185\u5bb9\u7c7b\u578b\u3002<code>Content-Type: multipart\/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW <\/code>\u5176\u4e2d\uff0c<code>boundary<\/code>\u00a0\u662f\u5206\u9694\u4e0d\u540c\u8868\u5355\u5b57\u6bb5\u548c\u6587\u4ef6\u6570\u636e\u7684\u6807\u8bc6\u7b26\u3002<\/li>\n\n\n\n<li><strong><code>Content-Type: multipart\/alternative<\/code><\/strong><br>\u9002\u7528\u4e8e\u90ae\u4ef6\uff0c\u8868\u793a\u5185\u5bb9\u6709\u591a\u4e2a\u4e0d\u540c\u7684\u683c\u5f0f\uff08\u5982\u7eaf\u6587\u672c\u548c HTML \u683c\u5f0f\u7684\u90ae\u4ef6\u6b63\u6587\uff09\uff0c\u63a5\u6536\u65b9\u53ef\u4ee5\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u3002<code>Content-Type: multipart\/alternative; boundary=\"----boundarystring\"<\/code><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">5.&nbsp;<strong>\u97f3\u9891\u548c\u89c6\u9891\u7c7b\u578b\uff08<code>audio\/*<\/code>&nbsp;\u548c&nbsp;<code>video\/*<\/code>\uff09<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>Content-Type: audio\/mpeg<\/code><\/strong><br>MPEG \u97f3\u9891\u683c\u5f0f\uff0c\u5e38\u89c1\u7684\u97f3\u9891\u6587\u4ef6\u7c7b\u578b\u3002<code>Content-Type: audio\/mpeg<\/code><\/li>\n\n\n\n<li><strong><code>Content-Type: video\/mp4<\/code><\/strong><br>MP4 \u89c6\u9891\u683c\u5f0f\u3002<code>Content-Type: video\/mp4<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">3.&nbsp;<strong>\u9644\u52a0\u53c2\u6570\uff08Parameters\uff09<\/strong><\/h3>\n\n\n\n<p>\u6709\u4e9b&nbsp;<code>Content-Type<\/code>&nbsp;\u8fd8\u53ef\u4ee5\u5305\u62ec\u9644\u52a0\u7684\u53c2\u6570\uff0c\u901a\u5e38\u7528\u4e8e\u6307\u5b9a\u7f16\u7801\u65b9\u5f0f\u3001\u5b57\u7b26\u96c6\u7b49\u3002\u5e38\u89c1\u7684\u9644\u52a0\u53c2\u6570\u6709\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>charset<\/strong>\uff1a\u7528\u4e8e\u6307\u5b9a\u5b57\u7b26\u7f16\u7801\uff0c\u5e38\u89c1\u4e8e\u6587\u672c\u7c7b\u578b\uff08\u5982\u00a0<code>text\/html<\/code>\u3001<code>text\/plain<\/code>\u00a0\u7b49\uff09\u3002<code>Content-Type: text\/html; charset=UTF-8<\/code><\/li>\n\n\n\n<li><strong>boundary<\/strong>\uff1a\u7528\u4e8e\u00a0<code>multipart<\/code>\u00a0\u7c7b\u578b\uff0c\u6307\u5b9a\u5206\u9694\u7b26\uff0c\u533a\u5206\u4e0d\u540c\u7684\u8868\u5355\u6570\u636e\u3002<code>Content-Type: multipart\/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">4.&nbsp;<strong>\u603b\u7ed3<\/strong><\/h3>\n\n\n\n<p><code>Content-Type<\/code>&nbsp;\u662f HTTP \u8bf7\u6c42\u548c\u54cd\u5e94\u4e2d\u7684\u91cd\u8981\u5934\u90e8\u5b57\u6bb5\uff0c\u6307\u5b9a\u4e86\u8bf7\u6c42\u6216\u54cd\u5e94\u4f53\u7684\u683c\u5f0f\uff0c\u786e\u4fdd\u670d\u52a1\u5668\u548c\u5ba2\u6237\u7aef\u80fd\u591f\u6b63\u786e\u89e3\u6790\u548c\u5904\u7406\u6570\u636e\u3002\u6839\u636e\u4e0d\u540c\u7684\u573a\u666f\uff0c<code>Content-Type<\/code>&nbsp;\u7684\u503c\u4f1a\u6709\u6240\u4e0d\u540c\uff0c\u5e38\u89c1\u7684\u7c7b\u578b\u5305\u62ec&nbsp;<code>text\/*<\/code>\u3001<code>application\/*<\/code>\u3001<code>image\/*<\/code>\u3001<code>audio\/*<\/code>\u3001<code>video\/*<\/code>&nbsp;\u7b49\u3002<\/p>\n\n\n\n<p><strong>\u5e38\u89c1\u7528\u6cd5\u603b\u7ed3<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>text\/html<\/code>\uff1a\u7528\u4e8e HTML \u9875\u9762\u3002<\/li>\n\n\n\n<li><code>application\/json<\/code>\uff1a\u7528\u4e8e JSON \u6570\u636e\u4ea4\u6362\u3002<\/li>\n\n\n\n<li><code>application\/xml<\/code>\uff1a\u7528\u4e8e XML \u6570\u636e\u3002<\/li>\n\n\n\n<li><code>image\/jpeg<\/code>\u3001<code>image\/png<\/code>\uff1a\u7528\u4e8e\u56fe\u7247\u6587\u4ef6\u3002<\/li>\n\n\n\n<li><code>multipart\/form-data<\/code>\uff1a\u7528\u4e8e\u8868\u5355\u6587\u4ef6\u4e0a\u4f20\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u901a\u8fc7\u9002\u5f53\u8bbe\u7f6e&nbsp;<code>Content-Type<\/code>\uff0c\u786e\u4fdd\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u53ef\u4ee5\u6b63\u786e\u5730\u5904\u7406\u4f20\u8f93\u7684\u6570\u636e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 HTTP \u534f\u8bae\u4e2d\uff0cContent-Type&nbsp;\u5934\u90e8\u5b57\u6bb5\u7528\u4e8e\u544a\u77e5\u63a5\u6536\u65b9&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2025\/11\/20\/http%e4%b8%ad%e7%9a%84content-type%e8%af%a6%e8%a7%a3\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-57","post","type-post","status-publish","format-standard","hentry","category-html-xhtml"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/57","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=57"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/57\/revisions"}],"predecessor-version":[{"id":58,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/57\/revisions\/58"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=57"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=57"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=57"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}