当前位置:网站首页>Go-based web access parameters
Go-based web access parameters
2022-08-09 13:02:00 【51CTO】
webThere are generally available parametersheader字段,body字段,Form字段
1、Get it firstheader字段
这样r.Header获取到所有Header的参数,If you want to get one of them use
这2The difference between the two statements is that the first returns a string slice,The second returns string form.
2、获取body字段
3、Form字段
r.ParseForm()is to parse the parameters first,这样r.Form才能获取到.For example, there are parametersabc=111,
使用r.Form["abc"]获取参数,也可以使用r.PostForm.
Form和PostForm之间的区别在于Form可以获取到URL后面的参数和post里面的参数,
PostForm只能获取post中的参数,也就是说Form是可以获取到get方法参数.
这2In the middle way, it is not necessary to executer.ParseForm()parameters can be obtained.
4、MultipartForm
从multipartHow many bytes of data are taken out of the encoded form.MultipartFormOnly form key-value pairs can be included and not includedURL键值对.
获取上传文件2中方式
1、r.ParseMultipartForm(1024)
2、r.FormFile("file")
边栏推荐
- proto3-2语法
- 世界第4疯狂的科学家,在103岁生日那天去世了
- proto3-2 syntax
- LeetCode_单调栈_中等_456.132 模式
- Byte Qiu Zhao confused me on both sides, and asked me under what circumstances would the SYN message be discarded?
- Gumbel_Softmax 概要
- Common gadgets of Shell (sort, uniq, tr, cut)
- 防止数据冒用的方法
- 在北京参加UI设计培训到底怎么样?
- ABAP 面试题:如何使用 ABAP 编程语言的 System CALL 接口,直接执行 ABAP 服务器所在操作系统的 shell 命令?
猜你喜欢
随机推荐
"Digital Economy Panorama White Paper" Special Analysis of Banking Industry Intelligent Marketing Application Released
Web console control edit box
2022牛客多校(六)M. Z-Game on grid
LeetCode_单调栈_中等_456.132 模式
电解电容漏电流及均压
GRPC整体学习
MongoDB-查询中$all的用法介绍
结构体变量的首地址获取注意事项
Apexsqlrecover无法连接数据库
How should the acceptance criteria for R&D requirements be written?| Agile Practices
ARP协议原理
字节秋招二面把我干懵了,问我SYN报文什么情况下会被丢弃?
微信一面:一致性哈希是什么,使用场景,解决了什么问题?
go基础之web获取参数
告别手摇织布机的AI时代
十分钟教会你如何使用VitePress搭建及部署个人博客站点
Blocking, non-blocking, multiplexing, synchronous, asynchronous, BIO, NIO, AIO all in one pot
【Untitled】
Summary of learning stages (knapsack problem)
Senior told me that the giant MySQL is through SSH connection