method public

File::addCookie()

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

Сигнатура

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

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

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

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

use Bitrix\Main\Engine\Response\File;

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

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

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

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

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