Re: session_destroy() doesn't work
| From: | Curts | Date: | Mon, 18 Dec 2000 17:23:29 +0000 |
| Subject: | Re: session_destroy() doesn't work | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30874@lists.php.net to get a copy of this message | ||
Ok... this may sound weird, but you have to start the session in order to
destroy it.
So either pass in the session ID, or call "session_start()". This should work:
<?
session_start(); // start session
session_destroy(); // destroy session
// clean up leftover garbage
$p = session_get_cookie_params();
setcookie(session_name(), "", 0, $p["path"], $p["domain"]);
// send user somewhere
header("Location: /RedirectPage.php");
?>
Hope that helps.
Rob
On Mon, 18 Dec 2000, Worawisut Pinyoyang wrote:
> when i call session_destroy() it shows me the error:
>
> Warning: Session object destruction failed in D:\wgs\dev\logout.php on
> line 4
>
> what's the error? and how can i solve it?
>
> Thanks in advance.And thanks for every help.
>
> -Worawisut
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
/**
* Rob Curts
* rob@siliconcarne.net
* http://www.siliconcarne.net/
* Siliconcarne
* internet software solutions
* Cambridge, MA
*/