session_destroy
(PHP 4 , PHP 5)
session_destroy -- セッションに登録されたデータを全て破棄する
説明
bool
session_destroy ( void )
session_destroy()は、現在のセッションに
関連づけられた全てのデータを破棄します。この関数は、
セッションに関するグローバル変数を破棄しません。また、セッション
クッキーを破棄しません。
この関数はセッションデータの破棄に成功した場合にTRUE、失敗した
場合にFALSEを返します。
例 1. セッションを破棄する
<?php
// Initialize the session. // If you are using session_name("something"), don't forget it now! session_start(); // Unset all of the session variables. session_unset(); // Finally, destroy the session. session_destroy();
?>
|
|
例 2. $_SESSIONでセッションを破棄する
<?php
// Initialize the session. // If you are using session_name("something"), don't forget it now! session_start(); // Unset all of the session variables. $_SESSION = array(); // Finally, destroy the session. session_destroy();
?>
|
|