Files
gf/geg/net/ghttp/server/session.go
2019-04-03 00:03:46 +08:00

19 lines
338 B
Go

package main
import (
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/net/ghttp"
"github.com/gogf/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()
}