-2

I have a php code that says this time for the cookie to expire What exactly does this mean?

time()+1*24*60*60;
Amir Salar
  • 1
  • 1
  • 7

1 Answers1

1

As hinted to in the comments - that's a calculation of seconds from the current time. That's 1 day (86400 seconds).

7 Days could be calculated similarly as:

time() + (7 * 24 * 60 * 60);

You can find a lot more explanation and examples in the PHP manual for the time() function - https://www.php.net/manual/en/function.time.php

steve
  • 2,469
  • 1
  • 23
  • 30
  • Thanks for the reply But this // time () + 1 * 24 * 60 * 60; // It's been more than two days I tested but it has not been deleted yet – Amir Salar Dec 19 '20 at 19:30
  • The browser will usually delete a cookie once it has expired. Check that the cookie has been set with the correct expiry date by using Chrome browser. On the relevant web page Right click and choose 'Inspect'. Go to the application tab and you'll be able to select Cookies for the relevant domain on the left hand side. Check what the browser is seeing your cookie as expiry date wise. – steve Dec 20 '20 at 10:15