1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 19:10:54 +00:00

Merge pull request #71 from yecrane/master

form获取相同名字的对象数组值
This commit is contained in:
astaxie 2013-06-17 01:03:04 -07:00
commit 6a260ca76d

View File

@ -261,6 +261,18 @@ func (c *Controller) GetString(key string) string {
return c.Input().Get(key) return c.Input().Get(key)
} }
func (c *Controller) GetStrings(key string) []string {
r := c.Ctx.Request;
if r.Form == nil {
return []string{}
}
vs := r.Form[key]
if len(vs) > 0 {
return vs
}
return []string{}
}
func (c *Controller) GetInt(key string) (int64, error) { func (c *Controller) GetInt(key string) (int64, error) {
return strconv.ParseInt(c.Input().Get(key), 10, 64) return strconv.ParseInt(c.Input().Get(key), 10, 64)
} }