mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
改进gview内置变量在没有配置管理文件时的处理
This commit is contained in:
@ -65,7 +65,13 @@ func (r *Response) buildInVars(params map[string]interface{}) map[string]interfa
|
||||
if params == nil {
|
||||
params = make(map[string]interface{})
|
||||
}
|
||||
params["Config"] = gins.Config().GetMap("")
|
||||
|
||||
c := gins.Config()
|
||||
if c.GetFilePath() != "" {
|
||||
params["Config"] = c.GetMap("")
|
||||
} else {
|
||||
params["Config"] = nil
|
||||
}
|
||||
params["Cookie"] = r.request.Cookie.Map()
|
||||
params["Session"] = r.request.Session.Data()
|
||||
return params
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"gitee.com/johng/gf/g/frame/gins"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Print(1)
|
||||
fmt.Print(gins.Config().GetFilePath())
|
||||
}
|
||||
Reference in New Issue
Block a user