💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### BindQuery\\ShouldBindQuery(只限查询参数) BindQuery\ShouldBindQuery函数只绑定查询参数,而不绑定POST数据。 我现在只BindQuery来试验,ShouldBindQuery我测试输出结果一样 ~~~ package main import "log" import "github.com/gin-gonic/gin" type Person struct { Name string `form:"name"` Address string `form:"address"` } func main() { route := gin.Default() route.Any("/testing", startPage) route.Run(":8080") } func startPage(c *gin.Context) { var person Person if c.BindQuery(&person) == nil { log.Println("====== Only Bind Query String ======") log.Println(person.Name) log.Println(person.Address) } c.String(200, "Success") } ~~~