1、  ?id=2&name=hello

    id := context.Query("id")
    name := context.Request.URL.Query().Get("name")
    var u model.User
   if context.Bind(&u) == nil {
        fmt.Println(u.Id)

 

2、  /user/2/hello

// 获取请求参数
    id := context.Param("id")
    name := context.Param("username")

正在整理笔记,如雷同,请告知,必添加!

相关文章:

  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
猜你喜欢
  • 2021-07-27
  • 2021-08-22
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
  • 2021-07-29
  • 2021-06-06
相关资源
相似解决方案