©
本文檔使用 php中文網手册 發布
[#1] Anonymous [2008-01-13 14:38:41]
Try also
* INI_Get('session.cookie_lifetime')
* INI_Get('session.cookie_path')
* INI_Get('session.cookie_domain')
* INI_Get('session.cookie_secure')
* INI_Get('session.cookie_httponly')
separately instead of session_Get_Cookie_Params().
Additionally there is a "bug" - session.cookie_lifetime is mentioned twice in the description.
[#2] powerlord at spamless dot vgmusic dot com [2002-11-18 23:35:30]
This function is quite handy when it comes to expiring session cookies... since Session cookies don't automatically get destroyed (see the session_destroy page).
For instance, here's what I plan to use to expire session cookies:
$CookieInfo = session_get_cookie_params();
if ( (empty($CookieInfo['domain'])) && (empty($CookieInfo['secure'])) ) {
setcookie(session_name(), '', time()-3600, $CookieInfo['path']);
} elseif (empty($CookieInfo['secure'])) {
setcookie(session_name(), '', time()-3600, $CookieInfo['path'], $CookieInfo['domain']);
} else {
setcookie(session_name(), '', time()-3600, $CookieInfo['path'], $CookieInfo['domain'], $CookieInfo['secure']);
}
session_destroy();
It doesn't check to see if the path part of the session cookie is set because the defaults in php.ini have this set already, unlike domain and secure.