/**
* Set cookie parameters.
*
* @see http://php.net/manual/en/function.session-set-cookie-params.php
*
* @param int $lifetime The lifetime of the cookie in seconds
* @param string|null $path The path where information is stored
* @param string|null $domain The domain of the cookie
* @param bool $secure The cookie should only be sent over secure connections
* @param bool $httpOnly The cookie can only be accessed through the HTTP protocol
*/
public function setCookieParams(
int $lifetime,
?string $path = null,
?string $domain = null,
bool $secure = false,
bool $httpOnly = false
): void
Examples
$session->setCookieParams(60, '/', '', false, false);
Getting Started
Methods
- all Gets all session values as array.
- close Force the session to be saved and closed. Session data is usually stored after your script terminated without the need to call close(), but as session data is locked to prevent concurrent writes only one script may operate on a session at any time. When using framesets together with sessions you will experience the frames loading one by one due to this locking. You can reduce the time needed to load all the frames by ending the session as soon as all changes to session variables are done.
- delete Deletes an attribute by key.
- destroy Deletes an attribute by key.
- flush Flush all session data.
- get Gets an attribute by key.
- getCookieParams Get cookie parameters.
- getId Returns the session ID.
- getName Returns the session name.
- getOptions Get session runtime configuration.
- has Returns true if the key exists.
- isStarted Checks if the session was started.
- pull Gets an session attribute by key and remove it.
- regenerateId Regenerates the session ID
- set Sets an session attribute by key.
- setCookieParams Set cookie parameters.
- setId Sets the session ID.
- setOptions Set session runtime configuration.
- start Starts the session.