Golang Gin 参数和模型绑定:修订历史

本页内容

差异选择:选中要对比的版本的单选按钮,按Enter键或下方的按钮。
说明:(当前)=与最后版本之间的差异,(之前)=与上一版本之间的差异,=小编辑。

2022年9月28日 (星期三)

2022年9月27日 (星期二)

  • 当前之前 15:292022年9月27日 (二) 15:29Neo 讨论 贡献 3,682字节 +3,682 创建页面,内容为“== 路由参数 == <sample title="" desc=""> func main() { router := gin.Default() // 此 handler 将匹配 /user/john 但不会匹配 /user/ 或者 /user router.GET("/user/:name", func(c *gin.Context) { name := c.Param("name") c.String(http.StatusOK, "Hello %s", name) }) // 此 handler 将匹配 /user/john/ 和 /user/john/send // 如果没有其他路由匹配 /user/john,它将重定向到 /user/john/ router.GET("/user/:name/*action", func(c *gi…”