github.com/gogf/gf@v1.16.9/.example/net/ghttp/server/controller/user.go (about) 1 package main 2 3 import ( 4 "github.com/gogf/gf/frame/g" 5 "github.com/gogf/gf/frame/gmvc" 6 ) 7 8 type User struct { 9 gmvc.Controller 10 } 11 12 func (c *User) Index() { 13 c.View.Display("index.html") 14 } 15 16 // 不符合规范,不会被自动注册 17 func (c *User) Test(value interface{}) { 18 c.View.Display("index.html") 19 } 20 21 func main() { 22 //g.View().SetPath("C:/www/static") 23 s := g.Server() 24 s.BindController("/user", new(User)) 25 s.SetPort(8199) 26 s.Run() 27 }