Response
in package
FinalYes
setup の HTTP レスポンスを表す値オブジェクト。
旧コードは各コントローラの中で print / header / die を直接呼んでいたが、Action は本オブジェクトを 返すだけにし、実際の出力(ヘッダ送出・本文 echo)は境界の emit 1 箇所に集約する。
Table of Contents
Properties
Methods
- body() : string
- emit() : void
- ステータス・ヘッダを送出し、本文を出力する。境界(エントリ)でのみ呼ぶ。
- headers() : array<string, string>
- html() : self
- redirect() : self
- status() : int
- __construct() : mixed
Properties
$body read-only
private
string
$body
$headers read-only
private
array<string|int, mixed>
$headers
$status read-only
private
int
$status
Methods
body()
public
body() : string
Return values
stringemit()
ステータス・ヘッダを送出し、本文を出力する。境界(エントリ)でのみ呼ぶ。
public
emit() : void
headers()
public
headers() : array<string, string>
Return values
array<string, string>html()
public
static html(string $body[, int $status = 200 ]) : self
Parameters
- $body : string
- $status : int = 200
Return values
selfredirect()
public
static redirect(string $location) : self
Parameters
- $location : string
Return values
selfstatus()
public
status() : int
Return values
int__construct()
private
__construct(int $status, array<string, string> $headers, string $body) : mixed
Parameters
- $status : int
- $headers : array<string, string>
- $body : string