Response
final class Response implements IResponse
HttpResponse class.
Properties
string | $cookieDomain | ||
string | $cookiePath | ||
bool | $cookieSecure | ||
bool | $cookieHttpOnly | ||
bool | $warnOnBuffer | ||
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.
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.
No description
Sends a cookie.
Deletes a cookie.
Details
at line 47
__construct()
No description
at line 61
IResponse
setCode(int $code, string $reason = null)
Sets HTTP response code.
at line 78
int
getCode()
Returns HTTP response code.
at line 89
IResponse
setHeader(string $name, string $value)
Sends an HTTP header and overwrites previously sent header of the same name.
at line 108
IResponse
addHeader(string $name, string $value)
Sends an HTTP header and doesn't overwrite previously sent header of the same name.
at line 121
self
deleteHeader(string $name)
Deletes a previously sent HTTP header.
at line 134
IResponse
setContentType(string $type, string $charset = null)
Sends a Content-type HTTP header.
at line 145
void
redirect(string $url, int $code = self::S302_FOUND)
Redirects to another URL. Don't forget to quit the script then.
at line 162
IResponse
setExpiration(string|null $time)
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 182
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 191
string|null
getHeader(string $header)
Returns the sent HTTP header, or null
if it does not exist. The parameter is case-insensitive.
at line 210
array
getHeaders()
Returns all sent HTTP headers as associative array.
at line 221
__destruct()
No description
at line 241
IResponse
setCookie(string $name, string $value, string|int|DateTimeInterface $time, string $path = null, string $domain = null, bool $secure = null, bool $httpOnly = null, string $sameSite = null)
Sends a cookie.
at line 281
deleteCookie(string $name, string $path = null, string $domain = null, bool $secure = null)
Deletes a cookie.
Traits
Strict class for better experience.