a-blog cms PHP API Reference

Response
in package

FinalYes

setup の HTTP レスポンスを表す値オブジェクト。

旧コードは各コントローラの中で print / header / die を直接呼んでいたが、Action は本オブジェクトを 返すだけにし、実際の出力(ヘッダ送出・本文 echo)は境界の emit 1 箇所に集約する。

Table of Contents

Properties

$body  : string
$headers  : array<string|int, mixed>
$status  : int

Methods

body()  : string
emit()  : void
ステータス・ヘッダを送出し、本文を出力する。境界(エントリ)でのみ呼ぶ。
headers()  : array<string, string>
html()  : self
redirect()  : self
status()  : int
__construct()  : mixed

Properties

$headers read-only

private array<string|int, mixed> $headers

Methods

body()

public body() : string
Return values
string

emit()

ステータス・ヘッダを送出し、本文を出力する。境界(エントリ)でのみ呼ぶ。

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
self

redirect()

public static redirect(string $location) : self
Parameters
$location : string
Return values
self

status()

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

        
On this page

Search results