method public

Redirect::addCookie()

Класс: \Bitrix\Main\Engine\Response\Redirect

Сигнатура

public addCookie(Cookie $cookie[, bool $replace = true ][, bool $checkExpires = true ]) : $this

Описание

Добавляет cookie в ответ.

Параметры

$cookie Cookie
Cookie.
$replace bool = true
Заменять существующий cookie или нет.
$checkExpires bool = true
Проверять значение expires у cookie или нет.

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

$this

Как применяется в Redirect

Redirect::addCookie() — метод класса \Bitrix\Main\Engine\Response\Redirect модуля «Главный модуль».

Метод объекта: сначала нужен экземпляр Redirect.

use Bitrix\Main\Engine\Response\Redirect;

/** @var Redirect $object */
$cookie = null; // Cookie
$result = $object->addCookie($cookie);
// $result: $this

Другие методы Redirect

addCookie() есть и у других классов модуля «Главный модуль»: AjaxJson, Archive, Base, BFile, Component, Component, Extension, File.

Исходный файл: source/main/lib/engine/response/redirect.php:105

Что будем искать? Например,Продвижение