模板引擎示例代码

This commit is contained in:
John 2018-01-04 22:38:47 +08:00
parent 855cb59caf
commit 4bcde5c999

View File

@ -4,6 +4,7 @@ import (
"gitee.com/johng/gf/g/net/ghttp"
"gitee.com/johng/gf/g/frame/gmvc"
"gitee.com/johng/gf/g/frame/gins"
"gitee.com/johng/gf/g/os/gview"
)
type ControllerTemplate struct {
@ -11,8 +12,12 @@ type ControllerTemplate struct {
}
func init() {
gins.View().
ghttp.GetServer().BindController("/template", &ControllerTemplate{})
ghttp.GetServer().BindHandler("/template/handler-info", Info)
ghttp.GetServer().BindControllerMethod("/template/ctl-info", &ControllerTemplate{}, "Info")
}
func Info(r *ghttp.Request) {
gins.View().SetPath("")
}
func (c *ControllerTemplate) Info() {