Bluz\Session\Session::set PHP Метод

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

Set key/value pair
public set ( string $key, mixed $value ) : void
$key string
$value mixed
Результат void
    public function set($key, $value)
    {
        $this->start();
        // check storage
        if (!isset($_SESSION[$this->getNamespace()])) {
            $_SESSION[$this->getNamespace()] = [];
        }
        $_SESSION[$this->namespace][$key] = $value;
    }

Usage Example

Пример #1
0
 /**
  * Complex test for __unset
  *
  * @covers \Bluz\Session\Session::delete()
  */
 public function testUnset()
 {
     $this->session->set('moo', 'maz');
     $this->session->delete('moo');
     $this->assertNull($this->session->get('moo'));
 }