Files
gf/.example/net/ghttp/server/session.go

19 lines
340 B
Go
Raw Normal View History

2018-04-30 22:28:01 +08:00
package main
import (
2019-07-29 21:01:19 +08:00
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/net/ghttp"
"github.com/gogf/gf/util/gconv"
2018-04-30 22:28:01 +08:00
)
func main() {
2019-04-03 00:03:46 +08:00
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()
}