gin路由获取变量
package main
import (
"github.com/gin-gonic/gin"
)
func main() {
// 初始化
router := gin.New();
router.POST("/:name/*attr", func(context *gin.Context) {
context.String(200,
"path param name:%s attr:%s id:%s type:%s",
context.Param("name"),
context.Param("attr"),
context.Query("id"),
context.PostForm("type"))
})
// 启动服务
router.Run(":8080")
}