gpt4 book ai didi

php - setcookie + strtotime ('tomorrow' ) 给出错误的日期

转载 作者:可可西里 更新时间:2023-11-01 01:08:42 26 4
gpt4 key购买 nike

今天 2011 年 5 月 18 日如果我这样做

echo date("H:i m/d/Y", strtotime("tomorrow"));

我应该得到 00:00 05/19/2011 但如果我在 setcookie 中使用相同的函数,例如:

setcookie("wls_yesterday_review", 'completed', strtotime('tomorrow'),'/','myhost.com');

我的 cookie 将于 2011 年 5 月 18 日晚上 09:00 过期

我不确定我做错了什么,但我测试了不同的方式和不同的时间,我总是得到相同的结果

我想在第二天的 00:00 使 cookie 过期。如果今天是 05/18 10:00am 我希望它在 05/19 00:00 过期

谢谢大家

最佳答案

setcookie("TestCookie", $value, time()+3600);  /* expire in 1 hour */
setcookie("TestCookie", $value, time()+3600*24); /* expire in 1 day */

http://php.net/manual/en/function.setcookie.php

关于php - setcookie + strtotime ('tomorrow' ) 给出错误的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6045365/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com