mirror of
https://github.com/astaxie/beego.git
synced 2025-07-03 03:10:18 +00:00
Add all type support for UrlFor’s params
This commit is contained in:
@ -429,7 +429,7 @@ func (p *ControllerRegistor) insertFilterRouter(pos int, mr *FilterRouter) error
|
||||
|
||||
// UrlFor does another controller handler in this request function.
|
||||
// it can access any controller method.
|
||||
func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string {
|
||||
func (p *ControllerRegistor) UrlFor(endpoint string, values ...interface{}) string {
|
||||
paths := strings.Split(endpoint, ".")
|
||||
if len(paths) <= 1 {
|
||||
Warn("urlfor endpoint must like path.controller.method")
|
||||
@ -444,9 +444,9 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string {
|
||||
key := ""
|
||||
for k, v := range values {
|
||||
if k%2 == 0 {
|
||||
key = v
|
||||
key = fmt.Sprint(v)
|
||||
} else {
|
||||
params[key] = v
|
||||
params[key] = fmt.Sprint(v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user