note 96867 deleted from function.session-set-cookie-params by danbrown
| From: | danbrown@php.net | Date: | Sat, 20 Mar 2010 00:00:50 +0000 |
| Subject: | note 96867 deleted from function.session-set-cookie-params by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-167239@lists.php.net to get a copy of this message | ||
Note Submitter: jan at dewal dot net
----
The information above about this function that it can only be used BEFORE session_start depends on
how you use it. Because its also useful AFTER a session has started as follows:
Example you wand to change an already set value of the session cookie expire time:
<?php
// Here we start as usual
session_set_cookie_parameters('3600'); // 1 hour
session_start();
// More code...
// Now we found in some database that the user whishes
// the cookie to expire after for example 10 minutes
// we can change it instantly !
session_set_cookie_parameters('600'); // 10 minutes.
session_regenerate_id(true);
// This will delete old cookie and adopt new expire settings and the
// old cookie variables in a new cookie
?>
Please note i only explained the browser (client) side changes of session cookie's expire time.