Files
gf/.example/net/ghttp/server/controller/view.go
2019-09-09 23:02:40 +08:00

24 lines
378 B
Go

package main
import (
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/frame/gmvc"
)
type Controller struct {
gmvc.Controller
}
func (c *Controller) Index() {
c.View.Assign("name", "john")
c.View.Assign("mainTpl", "main/main2.html")
c.View.Display("layout.html")
}
func main() {
s := g.Server()
s.BindController("/view", new(Controller))
s.SetPort(8199)
s.Run()
}