mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 19:20:59 +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:
parent
f7e7fab6f2
commit
0e748c6871
@ -548,9 +548,9 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
if strings.HasPrefix(strings.ToLower(requestPath), "/"+cName+"/"+strings.ToLower(mName)) {
|
if strings.HasPrefix(strings.ToLower(requestPath), "/"+cName+"/"+strings.ToLower(mName)) {
|
||||||
//parse params
|
//parse params
|
||||||
otherurl := requestPath[len("/"+cName+"/"+strings.ToLower(mName)):]
|
otherurl := requestPath[len("/"+cName+"/"+strings.ToLower(mName)):]
|
||||||
if len(otherurl) > 1 && otherurl[0] != '/' {
|
if len(otherurl) > 1 {
|
||||||
plist := strings.Split(otherurl, "/")
|
plist := strings.Split(otherurl, "/")
|
||||||
for k, v := range plist {
|
for k, v := range plist[1:] {
|
||||||
params[strconv.Itoa(k)] = v
|
params[strconv.Itoa(k)] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user