PHP Класс System\Response

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$headers array Array of headers to be sent
$output string The final output
$status integer The response status

Открытые методы

Метод Описание
__construct ( $output, $status = 200, $headers = [] ) Create a new instance of the Response class
create ( $output, $status = 200, $headers = [] ) : object Create a new instance of the Response class for chaining
json ( $output, $status = 200 ) : object Creates a response with the output as JSON
redirect ( $uri, $status = 302 ) : object Creates a response with a header to redirect
send ( ) Sends the final headers cookies and output

Описание методов

__construct() публичный Метод

Create a new instance of the Response class
public __construct ( $output, $status = 200, $headers = [] )

create() публичный статический Метод

Create a new instance of the Response class for chaining
public static create ( $output, $status = 200, $headers = [] ) : object
Результат object

json() публичный статический Метод

Creates a response with the output as JSON
public static json ( $output, $status = 200 ) : object
Результат object

redirect() публичный статический Метод

Creates a response with a header to redirect
public static redirect ( $uri, $status = 302 ) : object
Результат object

send() публичный Метод

Sends the final headers cookies and output
public send ( )

Описание свойств

$headers публичное свойство

Array of headers to be sent
public array $headers
Результат array

$output публичное свойство

The final output
public string $output
Результат string

$status публичное свойство

The response status
public int $status
Результат integer