fileSessionHandler
in package
implements
sessionHandlerInterface
Interfaces, Classes, Traits and Enums
Table of Contents
- $_sessionFilePrefix : string
- session file prefix.
- $_sessionSavePath : string|null
- session save path.
- __construct() : mixed
- fileSessionHandler constructor.
- close() : bool
- Close the session
- destroy() : bool
- Destroy a session
- gc() : bool
- Cleanup old sessions
- init() : mixed
- Init.
- open() : bool
- Initialize session
- read() : string
- Read session data
- sessionSavePath() : string
- Get or set session file path.
- updateTimestamp() : bool
- Update sesstion modify time.
- write() : bool
- Write session data
- sessionFile() : string
- Get session file path.
Properties
$_sessionFilePrefix
session file prefix.
private
static string
$_sessionFilePrefix
= 'session_'
$_sessionSavePath
session save path.
private
static string|null
$_sessionSavePath
= null
Methods
__construct()
fileSessionHandler constructor.
public
__construct([array<string|int, mixed> $config = [] ]) : mixed
Parameters
- $config : array<string|int, mixed> = []
Return values
mixed —close()
Close the session
public
close() : bool
Return values
bool —The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.
destroy()
Destroy a session
public
destroy(string $session_id) : bool
Parameters
- $session_id : string
-
The session ID being destroyed.
Return values
bool —The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.
gc()
Cleanup old sessions
public
gc(int $maxlifetime) : bool
Parameters
- $maxlifetime : int
-
Sessions that have not updated for the last maxlifetime seconds will be removed.
Return values
bool —The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.
init()
Init.
public
static init() : mixed
Return values
mixed —open()
Initialize session
public
open(string $save_path, string $name) : bool
Parameters
- $save_path : string
-
The path where to store/retrieve the session.
- $name : string
-
The session name.
Return values
bool —The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.
read()
Read session data
public
read(string $session_id) : string
Parameters
- $session_id : string
-
The session id to read data for.
Return values
string —Returns an encoded string of the read data. If nothing was read, it must return an empty string. Note this value is returned internally to PHP for processing.
sessionSavePath()
Get or set session file path.
public
static sessionSavePath(string $path) : string
Parameters
- $path : string
Return values
string —updateTimestamp()
Update sesstion modify time.
public
updateTimestamp(string $id[, string $data = "" ]) : bool
Parameters
- $id : string
-
session id.
- $data : string = ""
-
session Data.
Tags
Return values
bool —write()
Write session data
public
write(string $session_id, string $session_data) : bool
Parameters
- $session_id : string
-
The session id.
- $session_data : string
-
The encoded session data. This data is the result of the PHP internally encoding the $_SESSION superglobal to a serialized string and passing it as this parameter. Please note sessions use an alternative serialization method.
Tags
Return values
bool —The return value (usually TRUE on success, FALSE on failure). Note this value is returned internally to PHP for processing.
sessionFile()
Get session file path.
protected
static sessionFile(string $session_id) : string
Parameters
- $session_id : string