1 ZH_Forms
Lunny Xiao edited this page 2015-08-28 15:28:17 +08:00
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.

Forms

获取请求中的Query参数可以有多种方式

  • 通过ctx的Forms()获取
ctx.Forms().Get()
  • 通过ctx.Form系列方法获取
ctx.Form("get") // 返回string
ctx.FormInt("get", 1) // 返回int,如果不存在或者为0则返回1
...
...
  • 通过ctx.Req()返回的*http.Request获取
ctx.Req().FormValue("get") // 返回string