We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6442713 commit 87d37b6Copy full SHA for 87d37b6
ebook/06.1.md
@@ -60,8 +60,8 @@ w表示需要写入的response,cookie是一个struct,让我们来看一下co
60
61
我们来看一个例子,如何设置cookie
62
63
- expiration := *time.LocalTime()
64
- expiration.Year += 1
+ expiration := time.Now()
+ expiration = expiration.AddDate(1, 0, 0)
65
cookie := http.Cookie{Name: "username", Value: "astaxie", Expires: expiration}
66
http.SetCookie(w, &cookie)
67
0 commit comments