$headers
$headers : array
List of all HTTP request headers.
HTTP response when a download is requested.
setBody( $data) : \CodeIgniter\HTTP\Message|\CodeIgniter\HTTP\Response
Sets the body of the current message.
$data |
appendBody( $data) : \CodeIgniter\HTTP\Message|\CodeIgniter\HTTP\Response
Appends data to the body of the current message.
$data |
getHeader(string $name) : array|\CodeIgniter\HTTP\Header
Returns a single header object. If multiple headers with the same name exist, then will return an array of header objects.
string | $name |
getHeaderLine(string $name) : string
Retrieves a comma-separated string of the values for a single header.
This method returns all of the header values of the given case-insensitive header name as a string concatenated together using a comma.
NOTE: Not all header values may be appropriately represented using comma concatenation. For such headers, use getHeader() instead and supply your own delimiter when concatenating.
string | $name |
setHeader(string $name, array|null|string $value) : \CodeIgniter\HTTP\Message|\CodeIgniter\HTTP\Response
Sets a header and it's value.
string | $name | |
array|null|string | $value |
removeHeader(string $name) : \CodeIgniter\HTTP\Message
Removes a header from the list of headers we track.
string | $name |
appendHeader(string $name, string $value) : \CodeIgniter\HTTP\Message
Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess)
string | $name | |
string | $value |
prependHeader(string $name, string $value) : \CodeIgniter\HTTP\Message
Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess)
string | $name | |
string | $value |
setProtocolVersion(string $version) : \CodeIgniter\HTTP\Message
Sets the HTTP protocol version.
string | $version |
setStatusCode(\CodeIgniter\HTTP\int $code, \CodeIgniter\HTTP\string $reason = '') : self
Return an instance with the specified status code and, optionally, reason phrase.
If no reason phrase is specified, will default recommended reason phrase for the response's status code.
\CodeIgniter\HTTP\int | $code | The 3-digit integer result code to set. |
\CodeIgniter\HTTP\string | $reason | The reason phrase to use with the provided status code; if none is provided, will default to the IANA name. |
setDate(\DateTime $date) : \CodeIgniter\HTTP\ResponseInterface
Sets the date header
\DateTime | $date |
setContentType(\CodeIgniter\HTTP\string $mime, \CodeIgniter\HTTP\string $charset = 'UTF-8') : \CodeIgniter\HTTP\ResponseInterface
Sets the Content Type header for this response with the mime type and, optionally, the charset.
\CodeIgniter\HTTP\string | $mime | |
\CodeIgniter\HTTP\string | $charset |
setCache(array $options = array()) : \CodeIgniter\HTTP\ResponseInterface
A shortcut method that allows the developer to set all of the cache-control headers in one method call.
The options array is used to provide the cache-control directives for the header. It might look something like:
$options = [
'max-age' => 300,
's-maxage' => 900
'etag' => 'abcde',
];
Typical options are:
array | $options |
send() : \CodeIgniter\HTTP\ResponseInterface
Sends the output to the browser.
sendHeaders() : \CodeIgniter\HTTP\DownloadResponse
Sends the headers of this HTTP request to the browser.
sendBody() : \CodeIgniter\HTTP\DownloadResponse
output download file text.
sendBodyByFilePath() : \CodeIgniter\HTTP\DownloadResponse
output download text by file.
sendBodyByBinary() : \CodeIgniter\HTTP\DownloadResponse
output download text by binary