PHP 手冊
上一頁 |  | 下一頁

# session_destroy

(PHP 4 , PHP 5)

session_destroy -- Destroys all data registered to a session

## Description

bool session_destroy ( void )

session_destroy() destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie.

This function returns `TRUE` on success and `FALSE` on failure to destroy the session data.

示範 1.Destroying a 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_unset(); // Finally, destroy the session. session_destroy(); ?>`

示範 2.Destroying a session with $_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(); ?>`

上一頁 | 最開頭 | 下一頁
session_decode | 上一層 | session_encode