Documentation

Core_Response
in package

HTTP response.

$oCore_Response ->status(200) ->header('Content-Type', "text/plain; charset={$oSite->coding}") ->header('Last-Modified', gmdate('D, d M Y H:i:s', time()) . ' GMT') ->header('X-Powered-By', 'HostCMS') ->body('Page content') ->compress() ->sendHeaders() ->showBody();
Tags
subpackage

Core

version
7.x
author

Hostmake LLC

copyright

© 2005-2024 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru

Table of Contents

Properties

$_body  : string
Body
$_headers  : array<string|int, mixed>
Array of headers
$_httpStatusCode  : array<string|int, mixed>
List of HTTP codes
$_status  : mixed
Response status

Methods

body()  : Core_Response
Add response body
changeBody()  : Core_Response
Change response body
compress()  : Core_Response
Compress response body
getBody()  : string
Get body
getHeaders()  : array<string|int, mixed>
Get headers
getStatus()  : int
Get response status
header()  : Core_Response
Add response header
sendHeaders()  : Core_Response
Send response headers
sendHttpStatusCode()  : mixed
Send HTTP response code
showBody()  : Core_Response
Show response body
status()  : Core_Response
Set response status

Properties

$_body

Body

protected string $_body = \NULL

$_headers

Array of headers

protected array<string|int, mixed> $_headers = array()

$_httpStatusCode

List of HTTP codes

protected static array<string|int, mixed> $_httpStatusCode = array( // 1xx: Informational (Информационные). 100 => 'Continue', // (Продолжать). 101 => 'Switching Protocols', // (Переключение протоколов). 102 => 'Processing', // (Идет обработка). //2xx: Success (Успешно). 200 => 'OK', // (Хорошо). 201 => 'Created', // (Создано). 202 => 'Accepted', // (Принято). 203 => 'Non-Authoritative Information', // (Информация не авторитетна). 204 => 'No Content', // (Нет содержимого). 205 => 'Reset Content', // (Сбросить содержимое). 206 => 'Partial Content', // (Частичное содержимое). 207 => 'Multi-Status', // (Многостатусный). 226 => 'IM Used', // (IM использовано). //3xx: Redirection (Перенаправление). 300 => 'Multiple Choices', // (Множество выборов). 301 => 'Moved Permanently', // (Перемещено окончательно). 302 => 'Found', // (Найдено). 303 => 'See Other', // (Смотреть другое). 304 => 'Not Modified', // (Не изменялось). 305 => 'Use Proxy', // (Использовать прокси). 306 => '', // (зарезервировано). 307 => 'Temporary Redirect', // (Временное перенаправление). //4xx: Client Error (Ошибка клиента). 400 => 'Bad Request', // (Плохой запрос). 401 => 'Unauthorized', // (Неавторизован). 402 => 'Payment Required', // (Необходима оплата). 403 => 'Forbidden', // (Запрещено). 404 => 'Not Found', // (Не найдено). 405 => 'Method Not Allowed', // (Метод не поддерживается). 406 => 'Not Acceptable', // (Не приемлемо). 407 => 'Proxy Authentication Required', // (Необходима аутентификация прокси). 408 => 'Request Timeout', // (Время ожидания истекло). 409 => 'Conflict', // (Конфликт). 410 => 'Gone', // (Удален). 411 => 'Length Required', // (Необходима длина). 412 => 'Precondition Failed', // (Условие «ложно»). 413 => 'Request Entity Too Large', // (Размер запроса слишком велик). 414 => 'Request-URI Too Long', // (Запрашиваемый URI слишком длинный). 415 => 'Unsupported Media Type', // (Неподдерживаемый тип данных). 416 => 'Requested Range Not Satisfiable', // (Запрашиваемый диапазон не достижим). 417 => 'Expectation Failed', // (Ожидаемое не приемлемо). 418 => 'I\'m a teapot', // (Я - чайник). 422 => 'Unprocessable Entity', // (Необрабатываемый экземпляр). 423 => 'Locked', // (Заблокировано). 424 => 'Failed Dependency', // (Невыполненная зависимость). 425 => 'Unordered Collection', // (Неупорядоченный набор). 426 => 'Upgrade Required', // (Необходимо обновление). 449 => 'Retry With', // (Повторить с...). 456 => 'Unrecoverable Error', // (Некорректируемая ошибка...). //5xx: Server Error (Ошибка сервера). 500 => 'Internal Server Error', // (Внутренняя ошибка сервера). 501 => 'Not Implemented', // (Не реализовано). 502 => 'Bad Gateway', // (Плохой шлюз). 503 => 'Service Unavailable', // (Сервис недоступен). 504 => 'Gateway Timeout', // (Шлюз не отвечает). 505 => 'HTTP Version Not Supported', // (Версия HTTP не поддерживается). 506 => 'Variant Also Negotiates', // (Вариант тоже согласован). 507 => 'Insufficient Storage', // (Переполнение хранилища). 509 => 'Bandwidth Limit Exceeded', // (Исчерпана пропускная ширина канала). 510 => 'Not Extended', )

$_status

Response status

protected mixed $_status = 200

Methods

body()

Add response body

public body(string $body) : Core_Response
$oCore_Response ->body('Page content.') ->body('Additional page content.');
Parameters
$body : string
Return values
Core_Response

changeBody()

Change response body

public changeBody(string $body) : Core_Response
$oCore_Response ->body('New body');
Parameters
$body : string
Return values
Core_Response

compress()

Compress response body

public compress() : Core_Response
$oCore_Response->compress();
Tags
hostcms-event

Core_Response.onBeforeCompress

hostcms-event

Core_Response.onAfterCompress

Return values
Core_Response

getBody()

Get body

public getBody() : string
Return values
string

getHeaders()

Get headers

public getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

getStatus()

Get response status

public getStatus() : int
Return values
int

status

header()

Add response header

public header(string $name, string $value) : Core_Response
$oCore_Response->header('X-Powered-By', 'HostCMS');
Parameters
$name : string
$value : string
Return values
Core_Response

sendHeaders()

Send response headers

public sendHeaders() : Core_Response
$oCore_Response->sendHeaders();
Tags
hostcms-event

Core_Response.onBeforeSendHeaders

hostcms-event

Core_Response.onAfterSendHeaders

Return values
Core_Response

sendHttpStatusCode()

Send HTTP response code

public static sendHttpStatusCode(int $status) : mixed
Parameters
$status : int

Status code

showBody()

Show response body

public showBody() : Core_Response
$oCore_Response->showBody();
Tags
hostcms-event

Core_Response.onBeforeShowBody

hostcms-event

Core_Response.onAfterShowBody

Return values
Core_Response

        
On this page

Search results