http协议常用传参方式


http协议的四个部分:method,url,header,body

(PATH_INFO, URL Query String, Headers, Body)

PATH_INFO(path路径方式)
http://baidu.com/name/xiaoming/age/12

URL Query String (url查询字符串,以"?"作为标志)
这种在各种method(get,post,delete,put)都能使用,解析速度快
http://baidu.com/?name=xiaoming&age=13

Body(post方法)

(Content-Type: application/x-www-form-urlencoded;charset=utf-8、Content-Type: multipart/form-data、Content-Type: application/json;charset=utf-8(本来是响应头,但是普遍用在请求头))

Headers
curl --header 'token: 40d7c342c110414888cc2a0e1284c636' -H 'content-type:application/json' -X GET http://www.baidu.com
所有方法都可以,键值对形式


免责声明!

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



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