什么是 HTTPHeaderField:@“Content-Type"在目标 C [英] What is forHTTPHeaderField:@"Content-Type" in objective C

查看:48
本文介绍了什么是 HTTPHeaderField:@“Content-Type"在目标 C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一个关于目标C的问题.NSMutableURLRequest中的"content-type"是什么?它是否与我看到的 forHTTPHeaderField 的标头字段有关?

I want to ask an question about the objective C. What is "content-type" in the NSMutableURLRequest? Is it related to the header field as I see the forHTTPHeaderField?

另外,下面的语句有什么不同?

Also, what is the different between the following statement?

// statement 1
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];

// statement 2
[request setValue:@"text/html; charset=UTF-8" forHTTPHeaderField:@"Content-Type"];

非常感谢.

推荐答案

Content-type 被称为 MIME 类型,表示 HTTP 响应包含的数据类型.

Content-type is known as a MIME type that indicates what kind of data an HTTP response contains.

这里有更多关于 MIME 类型的信息和一些例子:http://en.wikipedia.org/维基/MIME

Here is more information about MIME types and some examples: http://en.wikipedia.org/wiki/MIME

有关 IANA 批准的官方 MIME 类型的完整列表,请查看此处:http://www.iana.org/assignments/media-types/

For a full list of official MIME types approved by the IANA, take a look here: http://www.iana.org/assignments/media-types/

回答您的其他问题:

  • 语句 1 是一种 MIME 类型,用于响应已填写的网络表单.

  • Statement 1 is a MIME type for a response to a web form that has been filled in.

语句 2 是标准 HTML 页面的 MIME 类型,该页面具有 UTF-8 字符集(基本上,国际支持与标准 ASCII 或其他内容).

Statement 2 is the MIME type for a standard HTML page which has a characterset of UTF-8 (basically, international support versus standard ASCII or something else).

这篇关于什么是 HTTPHeaderField:@“Content-Type"在目标 C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆