当前位置:网站首页>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")
边栏推荐
猜你喜欢
随机推荐
ThreadLocal的简单理解
软件测试——金融测试类面试题,看完直接去面试了
Recommend a free 50-hour AI computing platform
proto3-2 syntax
mysql + redis + flask + flask-sqlalchemy + flask-session 配置及项目打包移植部署
go基础之web获取参数
告别手摇织布机的AI时代
二重指针-char **、int **的作用
已解决IndentationError: unindent does not match any oute r indentation Level
2022 Niu Ke Duo School (6) M. Z-Game on grid
【面试高频题】可逐步优化的链表高频题
推荐一个免费50时长的AI算力平台
脱光衣服待着就能减肥,当真有这好事?
报告:想学AI的学生数量已涨200%,老师都不够用了
Fapi_StatusType Fapi_issueProgrammingCommand使用注意事项
The redis library cannot be imported
Apexsqlrecover cannot connect to database
Django cannot link mysql database
Scala 高阶(七):集合内容汇总(上篇)
问题来了:4GB物理内存的机器上申请8G内存能成功吗?