怎样把Cookie的生存时间设置为无限长啊,,,,

demo大师粉丝 2004-09-28 08:55:53
怎样把Cookie的生存时间设置为无限长啊,,,,
...全文
395 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
demo大师粉丝 2004-09-28
  • 打赏
  • 举报
回复
呵呵,,,谢谢两位的回答
xunyiren 2004-09-28
  • 打赏
  • 举报
回复
晕,不支持上标,最大为2的31次方,再减去1秒.
xunyiren 2004-09-28
  • 打赏
  • 举报
回复
setMaxAge
public void setMaxAge(int expiry)Sets the maximum age of the cookie in seconds.
A positive value indicates that the cookie will expire after that many seconds have passed. Note that the value is the maximum age when the cookie will expire, not the cookie's current age.

A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits. A zero value causes the cookie to be deleted.

Parameters:
expiry - an integer specifying the maximum age of the cookie in seconds; if negative, means the cookie is not stored; if zero, deletes the cookie

好像不能把Cookie的生存时间设置为无限长,最大为231-1秒.

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧