Spec-Zone.ru › Symfony 4.1

Куки

класс Cookie

Cookie представляет собой HTTP-cookie.

Свойства

protected $name
protected $value
protected $expires
protected $path
protected $domain
protected $secure
protected $httponly
protected $rawValue

Методы

__construct(string $name, string|null $value, string $expires = null, string $path = null, string $domain = '', bool $secure = false, bool $httponly = true, bool $encodedValue = false)

Устанавливает cookie.

__toString()

Возвращает HTTP-представление Cookie.

static Cookie fromString(string $cookie, string|null $url = null)

Создаёт экземпляр Cookie из значения заголовка Set-Cookie.

string getName()

Возвращает имя cookie.

string getValue()

Возвращает значение cookie.

string getRawValue()

Возвращает исходное значение cookie.

string|null getExpiresTime()

Возвращает время истечения срока действия cookie.

string getPath()

Возвращает путь cookie.

string getDomain()

Возвращает домен cookie.

bool isSecure()

Возвращает флаг secure cookie.

bool isHttpOnly()

Возвращает флаг httponly cookie.

bool isExpired()

Возвращает true, если cookie истекла.

Подробности

__construct(string $name, string|null $value, string $expires = null, string $path = null, string $domain = '', bool $secure = false, bool $httponly = true, bool $encodedValue = false)

Устанавливает cookie.

Параметры

string $name Имя cookie
string|null $value Значение cookie
string $expires Время истечения срока действия cookie
string $path Путь на сервере, в котором доступна cookie
string $domain Домен, в котором доступна cookie
bool $secure Указывает, что cookie должна передаваться только по защищённому соединению HTTPS
bool $httponly Флаг httponly cookie
bool $encodedValue Закодировано ли значение

__toString()

Возвращает HTTP-представление Cookie.

static Cookie fromString(string $cookie, string|null $url = null)

Создаёт экземпляр Cookie из значения заголовка Set-Cookie.

Параметры

string $cookie Значение заголовка Set-Cookie
string|null $url Базовый URL

Возвращаемое значение

Cookie

Исключения

InvalidArgumentException

string getName()

Возвращает имя cookie.

Возвращаемое значение

string Имя cookie

string getValue()

Возвращает значение cookie.

Возвращаемое значение

string Значение cookie

string getRawValue()

Возвращает исходное значение cookie.

Возвращаемое значение

string Значение cookie

string|null getExpiresTime()

Возвращает время истечения срока действия cookie.

Возвращаемое значение

string|null Время истечения срока действия cookie

string getPath()

Возвращает путь cookie.

Возвращаемое значение

string Путь cookie

string getDomain()

Возвращает домен cookie.

Возвращаемое значение

string Домен cookie

bool isSecure()

Возвращает флаг secure cookie.

Возвращаемое значение

bool Флаг secure cookie

bool isHttpOnly()

Возвращает флаг httponly cookie.

Возвращаемое значение

bool Флаг httponly cookie

bool isExpired()

Возвращает true, если cookie истекла.

Возвращаемое значение

bool true, если cookie истекла, иначе false

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/BrowserKit/Cookie.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API