package main
import (
"github.com/gogf/gf/v2/container/gtype"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
)
type Controller struct {
total *gtype.Int
}
func (c *Controller) Total(r *ghttp.Request) {
r.Response.Write("total:", c.total.Add(1))
}
func main() {
s := g.Server()
c := &Controller{
total: gtype.NewInt(),
}
s.BindHandler("/total", c.Total)
s.SetPort(8199)
s.Run()
}
2 Comments
qingtian009
有注册路由,为何没有注销路由
wongxy
有啥场景需要注销路由?