Documentation

HttpResponse

\Bitrix\Main\HttpResponse base class handles all types of http-response. Serves as container for:

  • Http-headers \Bitrix\Main\Web\HttpHeaders
    • \Bitrix\Main\HttpResponse::addHeader(
         $name,
         $value
      )
    • \Bitrix\Main\HttpResponse::setHeaders(
         Web\HttpHeaders $headers
      )
    • \Bitrix\Main\HttpResponse::getHeaders(
      )
  • Cookies \Bitrix\Main\Web\Cookie
    • \Bitrix\Main\HttpResponse::addCookie(
         Web\Cookie $cookie,
         $replace,
         $checkExpires)
    • \Bitrix\Main\HttpResponse::getCookies(
      )
  • Content, response body \Bitrix\Main\HttpResponse::$content
    • \Bitrix\Main\HttpResponse::setContent(
         $content
      )
    • \Bitrix\Main\HttpResponse::getContent(
      )

Using \Bitrix\Main\HttpResponse you can format app responses of any required type and content. Examples:

$response = new \Bitrix\Main\HttpResponse();
$response->addHeader('Content-Type', 'text/plain');
$response->addCookie(new \Bitrix\Main\Web\Cookie('Biscuits', 'Yubileynoye'));
$response->setContent('Hello, world!'); 


© «Bitrix24», 2001-2022
Up