1 ZH_Forms
Lunny Xiao edited this page 8 years ago
This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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
Table of Contents