This website uses Cookies to provide you with the best possible service. Please see our Privacy Policy for more information. Click the check box below to accept cookies. Then confirm with a click on "Save".  
Status: 2024-05-06

Session


is

is(string $sNamespace = '') : Session

Example

$oSession = Session::is();
// type: object
\MVC\Session::__set_state(array(
      '_aOption' =>    array (
        'cookie_httponly' => true,
        'auto_start' => 0,
        'save_path' => '/var/www/Emvicy/application/session',
        'cookie_secure' => false,
        'name' => 'Emvicy',
        'save_handler' => 'files',
        'cookie_lifetime' => 0,
        'gc_maxlifetime' => 65535,
        'gc_probability' => 1,
        'use_strict_mode' => 1,
        'use_cookies' => 1,
        'use_only_cookies' => 1,
        'upload_progress.enabled' => 1,
    ),
      '_sNamespace' => 'Emvicy',
      '_bSessionEnable' => true,
))

setNamespace

Session::is('Foo')
Session::is()->setNamespace(string $sNamespace = '') : Session|null

Example

Session::is('Foo');
// type: object
\MVC\Session::__set_state(array(
      '_aOption' =>    array (
        'cookie_httponly' => true,
        'auto_start' => 0,
        'save_path' => '/var/www/Emvicy/application/session',
        'cookie_secure' => false,
        'name' => 'Emvicy',
        'save_handler' => 'files',
        'cookie_lifetime' => 0,
        'gc_maxlifetime' => 65535,
        'gc_probability' => 1,
        'use_strict_mode' => 1,
        'use_cookies' => 1,
        'use_only_cookies' => 1,
        'upload_progress.enabled' => 1,
    ),
      '_sNamespace' => 'Foo',
      '_bSessionEnable' => true,
))

set

sets a value by its key.

Session::is()->set(string $sKey = '', mixed $mValue = null) : Session

Example

Session::is('Foo')
    ->set('foo', 'bar')
    ->set('milly', 'moo');

get

gets a value by its key.

Session::is()->get(string $sKey = '') : mixed

Example

Session::is('Foo')->get('foo');

Result

bar

getAll

gets session key/values on the current namespace

Session::is()->getAll() : mixed

Example

Session::is('Foo')->getAll();

Result

[
    'foo' => 'bar',
    'milly' => 'moo',
]

has

checks whether a given key exists.

Session::is()->has(string $sKey = '') : bool

Example

Session::is('Foo')->has('foo')

Result

true

empty

empty a session namespace; removes all data in the current namespace.

Session::is()->empty() : bool

Example

Session::is('Foo')->empty()

Result

true