note 84074 deleted from function.setcookie by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 17:44:34 +0000 |
| Subject: | note 84074 deleted from function.setcookie by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155016@lists.php.net to get a copy of this message | ||
Note Submitter: user at NOSPAM dot example dot com
----
Note for Opera (and maybe FF) users - if you're having trouble deleting the PHPSESSID cookie,
ensure you set the path when deleting, or Opera will ignore and send the cookie with all future
requests in that session, for example:
session_start()
// creates a cookie using "Set-Cookie: PHPSESSID=b45c661720e0b3d27954a7d0225b1156; path=/"
Then to delete...
session_start();
$_SESSION = array(); // destroy all $_SESSION data
setcookie(session_name(), "", time() - 3600, "/");
session_destroy();
Note the last parameter on setcookie() to set the path, Opera requires this.