27896c57 by yecrane

Update controller.go

form获取相同名字的对象数组值
1 parent 67695fac
...@@ -241,6 +241,18 @@ func (c *Controller) GetString(key string) string { ...@@ -241,6 +241,18 @@ func (c *Controller) GetString(key string) string {
241 return c.Input().Get(key) 241 return c.Input().Get(key)
242 } 242 }
243 243
244 func (c *Controller) GetStrings(key string) []string {
245 r := c.Ctx.Request;
246 if r.Form == nil {
247 return []string{}
248 }
249 vs := r.Form[key]
250 if len(vs) > 0 {
251 return vs
252 }
253 return []string{}
254 }
255
244 func (c *Controller) GetInt(key string) (int64, error) { 256 func (c *Controller) GetInt(key string) (int64, error) {
245 return strconv.ParseInt(c.Input().Get(key), 10, 64) 257 return strconv.ParseInt(c.Input().Get(key), 10, 64)
246 } 258 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!