Cookies
2 分钟阅读
原文:https://gobuffalo.io/documentation/request_handling/cookies/
Cookies Cookie
An HTTP cookie is a small piece of data that a server sends to the user’s web browser. The browser can store this data and send it back to the same server, even after the browser restart (unlike a browser session).
HTTP cookie 是服务器发送给用户网络浏览器的少量数据。浏览器可以存储此数据,并在浏览器重新启动后将其发送回同一服务器(与浏览器会话不同)。
(HTTP) cookies are commonly used to save users state (like whether the user logged-in). See https://golang.org/pkg/net/http/#Cookie for more information on cookies in Go.
(HTTP) cookie 通常用于保存用户状态(例如用户是否已登录)。有关 Go 中 cookie 的更多信息,请参阅 https://golang.org/pkg/net/http/#Cookie。
Setting a Cookie 设置 Cookie
|
|
Setting a Cookie with Expiration 设置带过期时间的 Cookie
|
|
Setting a Cookie with Path 设置带路径的 Cookie
|
|
Advanced setting a Cookie way 高级设置 Cookie 的方式
|
|
See Cookie struct for other parameters.
有关其他参数,请参阅 Cookie 结构。
Getting a Cookie 获取 Cookie
|
|
Deleting a Cookie 删除 Cookie
|
|