开发者

Cookie Expiration times

开发者 https://www.devze.com 2022-12-17 12:10 出处:网络
Is is possible to find out when a cookie expires, I have set my cookie up doing this $_COOKIE[] = setcookie(\"bangUser\", $unique, time() + (60*60*24*30));

Is is possible to find out when a cookie expires, I have set my cookie up doing this

$_COOKIE[] = setcookie("bangUser", $unique, time() + (60*60*24*30));

is possible to print out is expiration date on scre开发者_如何学编程en somehow?


Yes, you can use the date function to print out a pretty version of the timestamp that you are passing into your setcookie function. An example of the code you could implement is below. You could change the date format using the guide on this page.

$expireat = time() + (60*60*24*30);
setcookie("bangUser", $unique, $expireat);
echo date("l jS \of F Y h:i:s A",$expireat)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号