s::remove PHP Method

remove() static public method

Removes a value from the session by key
static public remove ( mixed $key ) : array
$key mixed The key to remove by
return array The session array without the value
    static function remove($key)
    {
        if (!isset($_SESSION)) {
            return false;
        }
        $_SESSION = a::remove($_SESSION, $key, true);
        return $_SESSION;
    }

Usage Example

示例#1
0
 public function message()
 {
     if ($message = s::get('message') and is_array($message)) {
         $text = a::get($message, 'text');
         $type = a::get($message, 'type', 'notification');
         $element = new Brick('div');
         $element->addClass('message');
         if ($type == 'error') {
             $element->addClass('message-is-alert');
         } else {
             $element->addClass('message-is-notice');
         }
         $element->append(function () use($text) {
             $content = new Brick('span');
             $content->addClass('message-content');
             $content->text($text);
             return $content;
         });
         $element->append(function () {
             $toggle = new Brick('a');
             $toggle->attr('href', url::current());
             $toggle->addClass('message-toggle');
             $toggle->html('<i>&times;</i>');
             return $toggle;
         });
         s::remove('message');
         return $element;
     }
 }
All Usage Examples Of s::remove