其他分享
首页 > 其他分享> > beego 获取POST Payload 参数

beego 获取POST Payload 参数

作者:互联网

  1. 在配置文件中 copyrequestbody = true
  2. 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)
    }
    

      示例:

            

 

            

 

          

 

 

 

 

标签:Username,beego,string,form,Ctx,user,POST,Password,Payload
来源: https://www.cnblogs.com/chenjiangbin/p/16219731.html