摘要: 返回四种格式的数据:1. []byte、string 2. json格式 3. html模板渲染 4. 静态资源设置 package main import ( "github.com/gin-gonic/gin" "net/http" ) func main() { router := gin.D 阅读全文
posted @ 2021-11-20 20:38 专职 阅读(1042) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "github.com/gin-gonic/gin" ) // gin框架提供给开发者表单实体绑定的功能,可以将表单数据与结构体绑定 type userRegister struct { UserName string `form:"usern 阅读全文
posted @ 2021-11-20 16:39 专职 阅读(607) 评论(0) 推荐(0) 编辑
摘要: 1. 方法一: 通用的处理方法 Handle package main import ( "fmt" "github.com/gin-gonic/gin" "log" ) func main() { router := gin.Default() router.Handle("GET","/hell 阅读全文
posted @ 2021-11-20 14:56 专职 阅读(512) 评论(0) 推荐(0) 编辑