session_destroy

(PHP 4 )

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();

?