dongyou6909 2016-04-20 09:27
浏览 152
已采纳

setcookie的最长时间是多少

Lets say I want the cookie to hold for a year. Would I have to write it like this:

setcookie("coo", $you, time()+(60 * 60 * 24 * 365), "/", 'xyz.com', isset($_SERVER["HTTPS"]), true);

Is it even legal in EU to place year long cookies into user's browsers?

  • 写回答

1条回答 默认 最新

  • doumang20060820 2016-04-20 09:35
    关注

    From the spec:

    Although servers can set the expiration date for cookies to the distant future, most user agents do not actually retain cookies for multiple decades. Rather than choosing gratuitously long expiration periods, servers SHOULD promote user privacy by selecting reasonable cookie expiration periods based on the purpose of the cookie. For example, a typical session identifier might reasonably be set to expire in two weeks.

    The ePrivacy directive:

    requires prior informed consent for storage ofor access to information stored on a user's terminal equipment. In other words, you must ask users if they agreeto [sic] most cookies and similar technologies (e.g. web beacons, Flash cookies, etc.) before the site starts to use them.

    I don't believe it makes any mention of duration.

    IANAL; don't take legal advice from "some guy on the Internet".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入