我正在设置一个新的 cookiefunc f1(w http.ResponseWriter, r *http.Request) {...expire := time.Now().AddDate(0, 1, 0)cookie := http.Cookie{"token", token, "/", "domain", expire, expire.Format(time.UnixDate), 86400, true, true, "token=" + token, []string{"token=" + token}}http.SetCookie(w, &cookie)然后我试图得到它func f2(w http.ResponseWriter, r *http.Request) {...cookie, err := r.Cookie("token")fmt.Println(cookie.Value)fmt.Println(cookie.Expires)输出valid_token_string0001-01-01 00:00:00 +0000 UTC值与我设置的相同,但 Expires 为空。为什么?
- 2 回答
- 0 关注
- 378 浏览
添加回答
举报
0/150
提交
取消