cookie::set PHP Метод

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

Set a new cookie
static public set ( string $key, string $value, integer $expires = 3600, string $domain = '/' ) : boolean
$key string The name of the cookie
$value string The cookie content
$expires integer The number of seconds until the cookie expires
$domain string The domain to set this cookie for.
Результат boolean true: the cookie has been created, false: cookie creation failed
    static function set($key, $value, $expires = 3600, $domain = '/')
    {
        if (is_array($value)) {
            $value = a::json($value);
        }
        $_COOKIE[$key] = $value;
        return @setcookie($key, $value, time() + $expires, $domain);
    }

Usage Example

Пример #1
0
 public static function set($type, $id, $message)
 {
     $c = config::get('notes');
     $c['name'] = "note-{$type}-{$id}";
     $c['value'] = $message;
     cookie::set($c);
 }
All Usage Examples Of cookie::set