Response
class Response (View source)
Methods
Get or set status code and return previous status code.
Shortcut for set header Note: While PHP internally discards headers containing line breaks and issues a warning, such content is explicitly forbidden by this function. An exception will now be thrown if line breaks are detected, preventing both silent issues and potential misinterpretations of header behavior.
Set Content-Type header or remove previously headers
Set HTTP cache or no-cache Note: $seconds and $modified accept English textual datetime descriptions (e.g., 'now', '+1 day', 'last Monday').
Force download current response
Details
static int
status(int $code = 0)
Get or set status code and return previous status code.
Note: If the status has changed, the Event::on('changestatus') event will be triggered
static
header(string $name, string|null $value, bool $replace = true)
Shortcut for set header Note: While PHP internally discards headers containing line breaks and issues a warning, such content is explicitly forbidden by this function. An exception will now be thrown if line breaks are detected, preventing both silent issues and potential misinterpretations of header behavior.
static
type(string|null $value, string|null $charset = null)
Set Content-Type header or remove previously headers
static
cache(int|string $seconds, int|string $modified = 0)
Set HTTP cache or no-cache Note: $seconds and $modified accept English textual datetime descriptions (e.g., 'now', '+1 day', 'last Monday').
static
download(string $name, int $length = 0)
Force download current response