Delete a Cookie in PHPDelete a cookie using the same pathExpire the cookie in the past and use the same path/domain scope used when it was created. Cookie settings: Use Secure on HTTPS sites, HttpOnly when JavaScript does not need the cookie, and choose SameSite according to the cross-site behavior your application requires.
Here time() gives us the time elapsed in seconds between current time and Unix Epoch (January 1 1970 00:00:00 GMT). From this value we are subtracting 3600 seconds to give a past time as expire time for the cookie.
Subhendu MohapatraAuthor & Instructor at plus2net I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning. Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
|