beego 获取POST Payload 参数
- 在配置文件中 copyrequestbody = true
-
type user struct { Username string `form:"username"` Password string `form:"password"` } func (this *LoginController) Login() { u := new(user) json.Unmarshal(this.Ctx.Input.RequestBody, &u) this.Ctx.WriteString(u.Username + "--" + u.Password) }
示例: