PHP/Cookie Session/session destroy — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:37, 26 мая 2010
Destroying a session
<source lang="html4strict">
<?php
session_start( );
$_SESSION["username"] = "Michele";
session_destroy( );
echo "At this point we can still see the value of username as ";
echo $_SESSION["username"]."
";
unset ($_SESSION["username");
if (is_null($_SESSION["username"])) {
echo "Now the value of username is (blank)";
} ?>
</source>
Ending a Session
<source lang="html4strict">
<?
session_start( ); $_SESSION = array( ); session_destroy( );
?>
</source>
function session_destroy() ends all persistent data corresponding to the current user session.
<source lang="html4strict">
Its syntax is: boolean session_destroy() <? session_start(); // do some session stuff session_destroy(); ?>
</source>