1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-01 06:33:26 +00:00

parse url to params

/object/login/2009/07/11
parse to ObjectController  Login function
params:map[0:2009 1:07 2:11]
This commit is contained in:
astaxie 2013-07-27 10:55:10 +08:00
parent f7e7fab6f2
commit 0e748c6871

View File

@ -548,9 +548,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
if strings.HasPrefix(strings.ToLower(requestPath), "/"+cName+"/"+strings.ToLower(mName)) {
//parse params
otherurl := requestPath[len("/"+cName+"/"+strings.ToLower(mName)):]
if len(otherurl) > 1 && otherurl[0] != '/' {
if len(otherurl) > 1 {
plist := strings.Split(otherurl, "/")
for k, v := range plist {
for k, v := range plist[1:] {
params[strconv.Itoa(k)] = v
}
}