note 94431 deleted from function.setcookie by mazzanet
| From: | mazzanet@php.net | Date: | Tue, 17 Aug 2010 01:36:25 +0000 |
| Subject: | note 94431 deleted from function.setcookie by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171749@lists.php.net to get a copy of this message | ||
Note Submitter: aziz [at] azizce [dot] com
----
By deleting cookies you should think server side too.
In this example:
<?php
// set the expiration date to one hour ago
setcookie ("TestCookie", "", time() - 3600);
setcookie ("TestCookie", "", time() - 3600, "/~rasmus/",
".example.com", 1);
?>
deletes just client side cookies.
You should use bellow example to delete both client and server side cookies:
<?php
// set the expiration date to one hour ago
setcookie ("TestCookie", "", time() - 3600);
unset($_COOKIE['TestCookie']);
// or
setcookie ("TestCookie", "", time() - 3600, "/~rasmus/",
".example.com", 1);
unset($_COOKIE['TestCookie'];
?>