package main
import (
"fmt"
"github.com/gin-gonic/gin"
"net/http"
)
func main() {
r := gin.Default()
r.LoadHTMLFiles("templates/login.tmpl")
r.GET("/login", func(c *gin.Context) {
c.HTML(http.StatusOK, "login.tmpl", nil)
})
r.POST("/login", func(c *gin.Context){
username := c.PostForm("username")
password := c.PostForm("password")
fmt.Println("username:", username)
fmt.Println("password", password)
})
r.Run()
}
【Gin框架】Gin获取表单数据
猜你喜欢
转载自blog.csdn.net/qq2942713658/article/details/112701187
今日推荐
周排行