页面表单:
<form action="/get" method="Post">
<tr>
<th>用户名</th>
<td>
<input type="text" name="username">
</td>
</tr>
<tr>
<th>密码</th>
<td>
<input type="text" name="password">
</td>
<tr>
<th colspan="2">
<button id="login">Login</button>
</th>
</tr>
</tr>
</form
自定义controllers:
//自定义控制器02
type ObjectController struct {
beego.Controller
}
//实现Post方法
func (this *ObjectController) Post() {
username := this.GetString("username")
password := this.GetString("password")
fmt.Println(username, password)
this.TplName = "main.tpl"
}
URL参数也是一样获取,Beego框架智能的为我们解析了请求参数,我们只需要通过key来获取即可
最后
以上就是冷傲龙猫最近收集整理的关于Beego获取请求参数的全部内容,更多相关Beego获取请求参数内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复