c.Param()c.Params/user/:id/:namec.Paramsc.Paramsgin.ParamKeyValue获取各类请求参数
c.Query()c.DefaultQuery()c.PostForm()c.DefaultPostForm()c.Query()c.Query()nameagec.DefaultQuery()c.DefaultQuery()nameagec.PostForm()c.DefaultPostForm()c.PostForm()nameagec.PostForm()c.DefaultPostForm()c.Request.ParseForm()c.Bind()c.ShouldBind()c.ShouldBindJSON()c.ShouldBindXML()Userc.Bind()formjsonxml对于JSON请求处理的特别说明
c.ShouldBindJSON()Userc.ShouldBindJSON()usernameemailShouldBindJSON()c.BindJSON()BindJSON()ShouldBindJSON()BindJSON()Content-TypeShouldBindJSON()BindJSON()BindJSON()各类数据格式处理
c.ShouldBind()Content-Typec.ShouldBind()usernameemailShouldBind()其他
除了上述方法外,Gin 框架还提供了一些其他方法来处理客户端提交的参数,例如:
c.GetHeader()c.GetRawData()c.Request.FormValue()c.Request.PostFormValue()以上方法使用起来比较灵活,可以根据具体的场景选择合适的方法。