关于application/x-www-form-urlencoded

这几天又开始用postman,对x-www-form-urlencoded做个简单了解。

<form action="form_action.asp" enctype="text/plain">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="submit" value="Submit" />
</form>

<form> 标签的 enctype 属性,规定在发送到服务器之前应该如何对表单数据进行编码。(表明提交数据的格式)编码格式

默认地,表单数据会编码为 "application/x-www-form-urlencoded"。就是说,在发送到服务器之前,所有字符都会进行编码(空格转换为 "+" 加号,特殊符号转换为 ASCII HEX 值)。

<form enctype="value">

form的enctype属性为编码方式,常用有前两种。

text/plain: 窗体数据以纯文本形式进行编码,其中不含任何控件或格式字符。

描述
application/x-www-form-urlencoded 在发送前编码所有字符(默认)
multipart/form-data

不对字符编码。

在使用包含文件上传控件的表单时,必须使用该值。

text/plain 空格转换为 "+" 加号,但不对特殊字符编码。

 

猜你喜欢

转载自my.oschina.net/anlve/blog/1824199
今日推荐