cutego/docs/gin获取参数.md

11 lines
342 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

```go
id := c.Query("id") // 查询请求URL后面拼接的参数
name := c.PostForm("name") // 从表单中查询参数
uuid := c.Param("uuid") // 取得URL中参数
s, _ := c.Get("current_manager") // 从用户上下文读取值
page := c.DefaultQuery("page", "0") // 查询请求URL后面的参数如果没有填写默认值
```