Skip to content

Commit 87d37b6

Browse files
committed
1 parent 6442713 commit 87d37b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ebook/06.1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ w表示需要写入的response,cookie是一个struct,让我们来看一下co
6060

6161
我们来看一个例子,如何设置cookie
6262

63-
expiration := *time.LocalTime()
64-
expiration.Year += 1
63+
expiration := time.Now()
64+
expiration = expiration.AddDate(1, 0, 0)
6565
cookie := http.Cookie{Name: "username", Value: "astaxie", Expires: expiration}
6666
http.SetCookie(w, &cookie)
6767

0 commit comments

Comments
 (0)