douyiken0968
2015-01-21 06:17
浏览 666
已采纳

如何在Go中删除Cookie

I've set a cookie and can see it in my browser. I couldn't find anyway to remove it. What I've tried was:

deleteCookie, _ := r.Cookie("login")
deleteCookie.Value = "" 
deleteCookie.MaxAge = -1
http.SetCookie(w, deleteCookie)

But the cookie is still there with it's original value after running this code.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题