Files
gf/.example/net/ghttp/server/controller/user.go

28 lines
437 B
Go
Raw Normal View History

2018-08-01 18:44:43 +08:00
package main
import (
2019-07-29 21:01:19 +08:00
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/frame/gmvc"
2018-08-01 18:44:43 +08:00
)
type User struct {
2019-04-03 00:03:46 +08:00
gmvc.Controller
2018-08-01 18:44:43 +08:00
}
func (c *User) Index() {
2019-04-03 00:03:46 +08:00
c.View.Display("index.html")
2018-08-01 18:44:43 +08:00
}
// 不符合规范,不会被自动注册
func (c *User) Test(value interface{}) {
2019-04-03 00:03:46 +08:00
c.View.Display("index.html")
}
2018-08-01 18:44:43 +08:00
func main() {
2019-04-03 00:03:46 +08:00
//g.View().SetPath("C:/www/static")
s := g.Server()
s.BindController("/user", new(User))
s.SetPort(8199)
s.Run()
2018-08-01 18:44:43 +08:00
}