Cookie
class Cookie
Represents a cookie.
Methods
__construct(string $name, string $value = null, int|string|DateTime|DateTimeInterface $expire, string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true) | ||
string | __toString() Returns the cookie as a string. | |
string | getName() Gets the name of the cookie. | |
string | getValue() Gets the value of the cookie. | |
string | getDomain() Gets the domain that the cookie is available to. | |
int | getExpiresTime() Gets the time the cookie expires. | |
string | getPath() Gets the path on the server in which the cookie will be available on. | |
bool | isSecure() Checks whether the cookie should only be transmitted over a secure HTTPS connection from the client. | |
bool | isHttpOnly() Checks whether the cookie will be made accessible only through the HTTP protocol. | |
bool | isCleared() Whether this cookie is about to be cleared. |
Details
__construct(string $name, string $value = null, int|string|DateTime|DateTimeInterface $expire, string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true)
Parameters
string | $name | The name of the cookie |
string | $value | The value of the cookie |
int|string|DateTime|DateTimeInterface | $expire | The time the cookie expires |
string | $path | The path on the server in which the cookie will be available on |
string | $domain | The domain that the cookie is available to |
bool | $secure | Whether the cookie should only be transmitted over a secure HTTPS connection from the client |
bool | $httpOnly | Whether the cookie will be made accessible only through the HTTP protocol |
Exceptions
InvalidArgumentException |
string __toString()
Returns the cookie as a string.
Return Value
string | The cookie |
string getName()
Gets the name of the cookie.
Return Value
string |
string getValue()
Gets the value of the cookie.
Return Value
string |
string getDomain()
Gets the domain that the cookie is available to.
Return Value
string |
int getExpiresTime()
Gets the time the cookie expires.
Return Value
int |
string getPath()
Gets the path on the server in which the cookie will be available on.
Return Value
string |
bool isSecure()
Checks whether the cookie should only be transmitted over a secure HTTPS connection from the client.
Return Value
bool |
bool isHttpOnly()
Checks whether the cookie will be made accessible only through the HTTP protocol.
Return Value
bool |
bool isCleared()
Whether this cookie is about to be cleared.
Return Value
bool |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.8/Symfony/Component/HttpFoundation/Cookie.html