6a260ca7 by astaxie

Merge pull request #71 from yecrane/master

form获取相同名字的对象数组值
2 parents 384fa8fd 27896c57
...@@ -261,6 +261,18 @@ func (c *Controller) GetString(key string) string { ...@@ -261,6 +261,18 @@ func (c *Controller) GetString(key string) string {
261 return c.Input().Get(key) 261 return c.Input().Get(key)
262 } 262 }
263 263
264 func (c *Controller) GetStrings(key string) []string {
265 r := c.Ctx.Request;
266 if r.Form == nil {
267 return []string{}
268 }
269 vs := r.Form[key]
270 if len(vs) > 0 {
271 return vs
272 }
273 return []string{}
274 }
275
264 func (c *Controller) GetInt(key string) (int64, error) { 276 func (c *Controller) GetInt(key string) (int64, error) {
265 return strconv.ParseInt(c.Input().Get(key), 10, 64) 277 return strconv.ParseInt(c.Input().Get(key), 10, 64)
266 } 278 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!