Response
final class Response implements IResponse
HttpResponse class.
Properties
$cookieDomain | The domain in which the cookie will be available |
||
$cookiePath | The path in which the cookie will be available |
||
$cookieSecure | Whether the cookie is available only through HTTPS |
||
$warnOnBuffer | Whether warn on possible problem with data in output buffer |
||
array read-only | $headers |
Methods
No description
Returns HTTP response code.
Sends an HTTP header and overwrites previously sent header of the same name.
Sends an HTTP header and doesn't overwrite previously sent header of the same name.
Deletes a previously sent HTTP header.
Sends a Content-type HTTP header.
Response should be downloaded with 'Save as' dialog.
Redirects to another URL. Don't forget to quit the script then.
Sets the expiration of the HTTP document using the Cache-Control
and Expires
headers.
Returns whether headers have already been sent from the server to the browser, so it is no longer possible to send headers or change the response code.
Returns the sent HTTP header, or null
if it does not exist. The parameter is case-insensitive.
Returns all sent HTTP headers as associative array.
Sends a cookie.
Deletes a cookie.
Details
at line 43
__construct()
No description
at line 56
IResponse
setCode(int $code, string|null $reason = null)
Sets HTTP response code.
at line 74
int
getCode()
Returns HTTP response code.
at line 84
IResponse
setHeader(string $name, string $value)
Sends an HTTP header and overwrites previously sent header of the same name.
at line 103
IResponse
addHeader(string $name, string $value)
Sends an HTTP header and doesn't overwrite previously sent header of the same name.
at line 115
self
deleteHeader(string $name)
Deletes a previously sent HTTP header.
at line 127
IResponse
setContentType(string $type, string|null $charset = null)
Sends a Content-type HTTP header.
at line 138
Response
sendAsFile(string $fileName)
Response should be downloaded with 'Save as' dialog.
at line 153
void
redirect(string $url, int $code = self::S302_Found)
Redirects to another URL. Don't forget to quit the script then.
at line 169
IResponse
setExpiration(string|null $expire)
Sets the expiration of the HTTP document using the Cache-Control
and Expires
headers.
The parameter is either a time interval (as text) or null
, which disables caching.
at line 189
bool
isSent()
Returns whether headers have already been sent from the server to the browser, so it is no longer possible to send headers or change the response code.
at line 198
string|null
getHeader(string $header)
Returns the sent HTTP header, or null
if it does not exist. The parameter is case-insensitive.
at line 215
array
getHeaders()
Returns all sent HTTP headers as associative array.
at line 231
IResponse
setCookie(string $name, string $value, string|int|DateTimeInterface|null $expire, string|null $path = null, string|null $domain = null, bool $secure = null, bool $httpOnly = true, string $sameSite = self::SameSiteLax)
Sends a cookie.
at line 259
deleteCookie(string $name, string|null $path = null, string|null $domain = null, bool $secure = null)
Deletes a cookie.