note 55380 added to function.setcookie
| From: | simon at ruderich dot com | Date: | Mon, 01 Aug 2005 21:21:58 +0000 |
| Subject: | note 55380 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92893@lists.php.net to get a copy of this message | ||
If you want to delete a session cookie, you can do it with this code:
<?php
session_start();
// many code
$sessionName = session_name();
$sessionCookie = session_get_cookie_params();
session_destroy();
setcookie($sessionName, false, $sessionCookie['lifetime'],
$sessionCookie['path'], $sessionCookie['domain'],
$sessionCookie['secure']);
?>
This works also well if the session cookie params or the session name were changed.
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55380
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55380&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55380&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55380&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55380&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55380&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55380&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55380&report=yes
Search -- http://master.php.net/manage/user-notes.php