mirror of
https://gitee.com/johng/gf
synced 2026-07-05 05:13:14 +08:00
23 lines
446 B
Go
23 lines
446 B
Go
package main
|
|
|
|
import (
|
|
"github.com/gogf/gf/frame/g"
|
|
"github.com/gogf/gf/net/ghttp"
|
|
"github.com/gogf/gf/os/gtime"
|
|
)
|
|
|
|
func main() {
|
|
s := g.Server()
|
|
s.SetSessionMaxAge(60)
|
|
s.SetSessionIdName("gpadminssid")
|
|
s.BindHandler("/set", func(r *ghttp.Request) {
|
|
r.Session.Set("time", gtime.Second())
|
|
r.Response.Write("ok")
|
|
})
|
|
s.BindHandler("/get", func(r *ghttp.Request) {
|
|
r.Response.WriteJson(r.Session.Map())
|
|
})
|
|
s.SetPort(8199)
|
|
s.Run()
|
|
}
|