Content-type的几种常见类型


1、form表单类型 ,浏览器的原生form表单

application/x-www-form-urlencoded

 

2、我们使用表单上传文件时,必须让 form 的 enctype 等于这个值

multipart/form-data

<form action="/" method="post" enctype="multipart/form-data">
  <input type="text" name="description">
  <input type="file" name="myFile">
  <button type="submit">Submit</button>
</form>

 3、序列化后的 JSON 字符串,最常用,特别适合 RESTful 的接口

 

application/json

4、是一种使用 HTTP 作为传输协议,XML 作为编码方式的远程调用规范

text/xml

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM