Skip to content

wowoniu/go-session

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

go-session

golang session管理实现

#使用

###在创建HTTPServer时 创建全局session管理器

sessionManager:=session.NewSessionManager(1800, "cookie", "sessionid")

###在http的响应函数中调用SessionStart函数 初始化session会话 和使用 func apiLogin(w http.ResponseWriter, r *http.Request) { session, _ := sessionManager.SessionStart(w, r) session.Set("username","zhangsan") fmt.Println(session.Get("username"))

}

Releases

No releases published

Packages

No packages published

Languages