1、get方式获取参数
Get、POST 等方式的请求,beego 里面会自动解析这些数据。
比如一个登陆页面的实现
前端我们是Post,用户名和密码
<form class="login_form" name = "login"method = "post" action="/article/user">
<h1 class="login_title">用户登录</h1>
<input type="text" class="input_txt" name = "username">
<input type="password" class="input_txt" name = "password">
<input type="submit" value="登 录" class="input_sub">
</form>
后端,我们使用下面这个方法来获取这些数据
- GetString(key string) string
- GetStrings(key string) []string
- GetInt(key string) (int64, error)
- GetBool(key string) (bool, error)
- GetFloat(key string) (float64, error)