このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 次のリビジョン 両方とも次のリビジョン | ||
apricot:core:response-class [2020/07/01 13:21] tanaka [ヘルバー関数] |
apricot:core:response-class [2020/07/01 13:33] tanaka [Responseクラス] |
||
---|---|---|---|
行 37: | 行 37: | ||
|hasFlash(string $key): | |hasFlash(string $key): | ||
|addFlash(string $key, $value): | |addFlash(string $key, $value): | ||
- | |commit()|レスポンスの確定| | + | |commit(int $response_code=null)|レスポンスの確定| |
{{fa> | {{fa> | ||
行 117: | 行 117: | ||
/** | /** | ||
* Commit Response Data | * Commit Response Data | ||
+ | * @param int $response_code | ||
*/ | */ | ||
- | public function commit() | + | public function commit(int $response_code=null) |
{ | { | ||
- | // Save old URL Path | + | // Set Http response code |
- | $this-> | + | |
+ | { | ||
+ | http_response_code | ||
+ | } | ||
// Output headers | // Output headers | ||
行 128: | 行 132: | ||
header($header); | header($header); | ||
} | } | ||
+ | |||
+ | // Save old URL Path | ||
+ | $this-> | ||
// Output flashes | // Output flashes | ||
行 147: | 行 154: | ||
|< | |< | ||
|setHtml(string $html=null): | |setHtml(string $html=null): | ||
- | |commit()|レスポンスの確定| | + | |commit(int $response_code=null)|レスポンスの確定| |
{{fa> | {{fa> | ||
行 191: | 行 198: | ||
* @see \Core\Foundation\Response:: | * @see \Core\Foundation\Response:: | ||
*/ | */ | ||
- | public function commit() | + | public function commit(int $response_code=null) |
{ | { | ||
- | parent:: | ||
- | |||
// headersに' | // headersに' | ||
$matchs= preg_grep('/ | $matchs= preg_grep('/ | ||
行 201: | 行 206: | ||
$this-> | $this-> | ||
} | } | ||
+ | |||
+ | parent:: | ||
// HTMLのレンダリング | // HTMLのレンダリング | ||
echo $this-> | echo $this-> | ||
+ | flush(); | ||
} | } | ||
} | } |