0e748c68 by astaxie

parse url to params

/object/login/2009/07/11
parse to ObjectController  Login function
params:map[0:2009 1:07 2:11]
1 parent f7e7fab6
...@@ -548,9 +548,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -548,9 +548,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
548 if strings.HasPrefix(strings.ToLower(requestPath), "/"+cName+"/"+strings.ToLower(mName)) { 548 if strings.HasPrefix(strings.ToLower(requestPath), "/"+cName+"/"+strings.ToLower(mName)) {
549 //parse params 549 //parse params
550 otherurl := requestPath[len("/"+cName+"/"+strings.ToLower(mName)):] 550 otherurl := requestPath[len("/"+cName+"/"+strings.ToLower(mName)):]
551 if len(otherurl) > 1 && otherurl[0] != '/' { 551 if len(otherurl) > 1 {
552 plist := strings.Split(otherurl, "/") 552 plist := strings.Split(otherurl, "/")
553 for k, v := range plist { 553 for k, v := range plist[1:] {
554 params[strconv.Itoa(k)] = v 554 params[strconv.Itoa(k)] = v
555 } 555 }
556 } 556 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!