PHP Класс Neos\Flow\Http\Cookie

См. также: http://tools.ietf.org/html/rfc6265
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$domain string Hosts to which this cookie will be sent (RFC 6265, 4.1.2.3)
$expiresTimestamp integer Unix timestamp of the expiration date / time or 0 for "session" expiration (RFC 6265, 4.1.2.1)
$httpOnly boolean
$maximumAge integer Number of seconds until the cookie expires (RFC 6265, 4.1.2.2)
$name string Cookie Name, a token (RFC 6265, 4.1.1)
$path string
$secure boolean
$value string

Открытые методы

Метод Описание
__construct ( string $name, mixed $value = null, integer | DateTime $expires, integer $maximumAge = null, string $domain = null, string $path = '/', boolean $secure = false, boolean $httpOnly = true ) Constructs a new Cookie object
__toString ( ) : string Renders the field value suitable for a HTTP "Set-Cookie" header.
createFromRawSetCookieHeader ( string $header ) : Cookie Creates a cookie (an instance of this class) by a provided raw header string like "foo=507d9f20317a5; path=/; domain=.example.org" This is is an implementation of the algorithm explained in RFC 6265, Section 5.2 A basic statement of this algorithm is to "ignore the set-cookie-string entirely" in case a required condition is not met. In these cases this function will return NULL rather than the created cookie.
expire ( ) : void Marks this cookie for removal.
getDomain ( ) : string Returns the domain this cookie is valid for.
getExpires ( ) : integer Returns the date and time of the Expires attribute, if any.
getMaximumAge ( ) : integer Returns the number of seconds until the cookie expires, if defined.
getName ( ) : string Returns the name of this cookie
getPath ( ) : string Returns the path this cookie is valid for.
getValue ( ) : mixed Returns the value of this cookie
isExpired ( ) : boolean Tells if this cookie is expired and will be removed in the user agent when it received the response containing this cookie.
isHttpOnly ( ) : boolean Tells if this cookie should only be used through the HTTP protocol.
isSecure ( ) : boolean Tells if the cookie was flagged to be sent over "secure" channels only.
setValue ( mixed $value ) : void Sets the value of this cookie

Описание методов

__construct() публичный Метод

Constructs a new Cookie object
public __construct ( string $name, mixed $value = null, integer | DateTime $expires, integer $maximumAge = null, string $domain = null, string $path = '/', boolean $secure = false, boolean $httpOnly = true )
$name string The cookie name as a valid token (RFC 2616)
$value mixed The value to store in the cookie. Must be possible to cast into a string.
$expires integer | DateTime Date and time after which this cookie expires.
$maximumAge integer Number of seconds until the cookie expires.
$domain string The host to which the user agent will send this cookie
$path string The path describing the scope of this cookie
$secure boolean If this cookie should only be sent through a "secure" channel by the user agent
$httpOnly boolean If this cookie should only be used through the HTTP protocol

__toString() публичный Метод

Renders the field value suitable for a HTTP "Set-Cookie" header.
public __toString ( ) : string
Результат string

createFromRawSetCookieHeader() публичный статический Метод

Creates a cookie (an instance of this class) by a provided raw header string like "foo=507d9f20317a5; path=/; domain=.example.org" This is is an implementation of the algorithm explained in RFC 6265, Section 5.2 A basic statement of this algorithm is to "ignore the set-cookie-string entirely" in case a required condition is not met. In these cases this function will return NULL rather than the created cookie.
См. также: http://tools.ietf.org/html/rfc6265
public static createFromRawSetCookieHeader ( string $header ) : Cookie
$header string The Set-Cookie string without the actual "Set-Cookie:" part
Результат Cookie

expire() публичный Метод

On executing this method, the expiry time of this cookie is set to a point in time in the past triggers the removal of the cookie in the user agent.
public expire ( ) : void
Результат void

getDomain() публичный Метод

Returns the domain this cookie is valid for.
public getDomain ( ) : string
Результат string The domain name

getExpires() публичный Метод

Note that this date / time is returned as a unix timestamp, no matter what the format was originally set through the constructor of this Cookie. The special case "no expiration time" is returned in form of a zero value.
public getExpires ( ) : integer
Результат integer A unix timestamp or 0

getMaximumAge() публичный Метод

This information is rendered as the Max-Age attribute (RFC 6265, 4.1.2.2). Note that not all browsers support this attribute.
public getMaximumAge ( ) : integer
Результат integer The maximum age in seconds, or NULL if none has been defined.

getName() публичный Метод

Returns the name of this cookie
public getName ( ) : string
Результат string The cookie name

getPath() публичный Метод

Returns the path this cookie is valid for.
public getPath ( ) : string
Результат string The path

getValue() публичный Метод

Returns the value of this cookie
public getValue ( ) : mixed
Результат mixed

isExpired() публичный Метод

Tells if this cookie is expired and will be removed in the user agent when it received the response containing this cookie.
public isExpired ( ) : boolean
Результат boolean True if this cookie is expired

isHttpOnly() публичный Метод

Tells if this cookie should only be used through the HTTP protocol.
public isHttpOnly ( ) : boolean
Результат boolean State of the "HttpOnly" attribute

isSecure() публичный Метод

This security measure only has a limited effect. Please read RFC 6265 Section 8.6 for more details.
public isSecure ( ) : boolean
Результат boolean State of the "Secure" attribute

setValue() публичный Метод

Sets the value of this cookie
public setValue ( mixed $value ) : void
$value mixed The new value
Результат void

Описание свойств

$domain защищенное свойство

Hosts to which this cookie will be sent (RFC 6265, 4.1.2.3)
protected string $domain
Результат string

$expiresTimestamp защищенное свойство

Unix timestamp of the expiration date / time or 0 for "session" expiration (RFC 6265, 4.1.2.1)
protected int $expiresTimestamp
Результат integer

$httpOnly защищенное свойство

protected bool $httpOnly
Результат boolean

$maximumAge защищенное свойство

Number of seconds until the cookie expires (RFC 6265, 4.1.2.2)
protected int $maximumAge
Результат integer

$name защищенное свойство

Cookie Name, a token (RFC 6265, 4.1.1)
protected string $name
Результат string

$path защищенное свойство

protected string $path
Результат string

$secure защищенное свойство

protected bool $secure
Результат boolean

$value защищенное свойство

protected string $value
Результат string