Files
gf/geg/net/ghttp/server/session.go
2018-11-16 18:20:09 +08:00

18 lines
381 B
Go

package main
import (
"gitee.com/johng/gf/g"
"gitee.com/johng/gf/g/net/ghttp"
"gitee.com/johng/gf/g/util/gconv"
)
func main() {
s := g.Server()
s.BindHandler("/session", func(r *ghttp.Request) {
id := r.Session.GetInt("id")
r.Session.Set("id", id + 1)
r.Response.Write("id:" + gconv.String(id))
})
s.SetPort(8199)
s.Run()
}