PHP Класс lithium\storage\session\adapter\Php

This adapter provides basic support for write, read and delete session handling, as well as allowing these three methods to be filtered as per the Lithium filtering system.
Наследование: extends lithium\core\Object
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_defaults Default ini settings for this session adapter. Will disabl cookie lifetime, set cookies to HTTP only and the cache_limiter to 'nocache'.

Открытые методы

Метод Описание
__construct ( array $config = [] ) : void Constructor. Takes care of setting appropriate configurations for this object. Also sets session ini settings.
check ( string $key, array $options = [] ) : Closure Checks if a value has been set in the session.
clear ( array $options = [] ) : Closure Clears all keys from the session.
delete ( string $key, array $options = [] ) : Closure Delete value from the session
enabled ( ) : boolean Determines if PHP sessions are enabled.
isStarted ( ) : boolean Obtain the status of the session.
key ( string $key = null ) : mixed Sets or obtains the session ID.
overwrite ( array &$old, array $new ) : boolean Overwrites session keys and values.
read ( null | string $key = null, array $options = [] ) : Closure Read a value from the session.
write ( string $key, mixed $value, array $options = [] ) : Closure Write a value to the session.

Защищенные методы

Метод Описание
_init ( ) Initialization of the session.
_start ( ) : boolean Starts the session.

Описание методов

__construct() публичный Метод

Constructor. Takes care of setting appropriate configurations for this object. Also sets session ini settings.
См. также: lithium\storage\session\adapter\Php::$_defaults
public __construct ( array $config = [] ) : void
$config array Configuration options matching the pattern `'session.*'` are interpreted as session ini settings. Please consult the PHP documentation for further information. A few ini settings are set by default here and will overwrite those from your php.ini. To disable sending a cache limiter set `'session.cache_limiter'` to `false`.
Результат void

_init() защищенный Метод

Initialization of the session.
protected _init ( )

_start() защищенный Метод

Starts the session.
protected _start ( ) : boolean
Результат boolean `true` if session successfully started (or has already been started), `false` otherwise.

check() публичный Метод

Checks if a value has been set in the session.
public check ( string $key, array $options = [] ) : Closure
$key string Key of the entry to be checked.
$options array Options array. Not used for this adapter method.
Результат Closure Function returning boolean `true` if the key exists, `false` otherwise.

clear() публичный Метод

Clears all keys from the session.
public clear ( array $options = [] ) : Closure
$options array Options array. Not used for this adapter method.
Результат Closure Function returning boolean `true` on successful clear, `false` otherwise.

delete() публичный Метод

Delete value from the session
public delete ( string $key, array $options = [] ) : Closure
$key string The key to be deleted.
$options array Options array. Not used for this adapter method.
Результат Closure Function returning boolean `true` if the key no longer exists in the session, `false` otherwise

enabled() публичный статический Метод

Determines if PHP sessions are enabled.
public static enabled ( ) : boolean
Результат boolean Returns `true` if enabled (PHP session functionality can be disabled completely), `false` otherwise.

isStarted() публичный Метод

Obtain the status of the session.
public isStarted ( ) : boolean
Результат boolean True if a session is currently started, False otherwise. If PHP 5.4 then we know, if PHP 5.3 then we cannot tell for sure if a session has been closed.

key() публичный Метод

Sets or obtains the session ID.
public key ( string $key = null ) : mixed
$key string Optional. If specified, sets the session ID to the value of `$key`.
Результат mixed Session ID, or `null` if the session has not been started.

overwrite() публичный Метод

Overwrites session keys and values.
public overwrite ( array &$old, array $new ) : boolean
$old array Reference to the array that needs to be overwritten. Will usually be `$_SESSION`.
$new array The data that should overwrite the keys/values in `$old`.
Результат boolean Always `true`.

read() публичный Метод

Read a value from the session.
public read ( null | string $key = null, array $options = [] ) : Closure
$key null | string Key of the entry to be read. If no key is passed, all current session data is returned.
$options array Options array. Not used for this adapter method.
Результат Closure Function returning data in the session if successful, `false` otherwise.

write() публичный Метод

Write a value to the session.
public write ( string $key, mixed $value, array $options = [] ) : Closure
$key string Key of the item to be stored.
$value mixed The value to be stored.
$options array Options array. Not used for this adapter method.
Результат Closure Function returning boolean `true` on successful write, `false` otherwise.

Описание свойств

$_defaults защищенное свойство

Default ini settings for this session adapter. Will disabl cookie lifetime, set cookies to HTTP only and the cache_limiter to 'nocache'.
protected $_defaults