mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
DOC Added a tip to docs describing how to set a cookie for less than a day (#9552)
DOC Added a tip to docs describing how to set a cookie for less than a day Co-authored-by: Garion Herman <garion@silverstripe.com>
This commit is contained in:
parent
589631df00
commit
2753f823ee
@ -25,6 +25,10 @@ Cookie::set($name, $value, $expiry = 90, $path = null, $domain = null, $secure =
|
||||
// Cookie::set('MyApplicationPreference', 'Yes');
|
||||
```
|
||||
|
||||
[info]
|
||||
To set a cookie for less than 1 day, you can assign an `$expiry` value that is lower than 1. e.g `Cookie::set('name', 'value', $expiry = 0.5);` will set a cookie for 12 hours.
|
||||
[/info]
|
||||
|
||||
### get
|
||||
|
||||
Returns the value of cookie.
|
||||
|
@ -36,7 +36,7 @@ class Cookie
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @param int $expiry
|
||||
* @param float $expiry
|
||||
* @param string $path
|
||||
* @param string $domain
|
||||
* @param bool $secure
|
||||
|
@ -63,7 +63,7 @@ class CookieJar implements Cookie_Backend
|
||||
*
|
||||
* @param string $name The name of the cookie
|
||||
* @param string $value The value for the cookie to hold
|
||||
* @param int $expiry The number of days until expiry; 0 indicates a cookie valid for the current session
|
||||
* @param float $expiry The number of days until expiry; 0 indicates a cookie valid for the current session
|
||||
* @param string $path The path to save the cookie on (falls back to site base)
|
||||
* @param string $domain The domain to make the cookie available on
|
||||
* @param boolean $secure Can the cookie only be sent over SSL?
|
||||
@ -152,7 +152,7 @@ class CookieJar implements Cookie_Backend
|
||||
*
|
||||
* @param string $name The name of the cookie
|
||||
* @param string|array $value The value for the cookie to hold
|
||||
* @param int $expiry The number of days until expiry
|
||||
* @param int $expiry A Unix timestamp indicating when the cookie expires; 0 means it will expire at the end of the session
|
||||
* @param string $path The path to save the cookie on (falls back to site base)
|
||||
* @param string $domain The domain to make the cookie available on
|
||||
* @param boolean $secure Can the cookie only be sent over SSL?
|
||||
|
@ -24,7 +24,7 @@ interface Cookie_Backend
|
||||
*
|
||||
* @param string $name The name of the cookie
|
||||
* @param string $value The value for the cookie to hold
|
||||
* @param int $expiry The number of days until expiry
|
||||
* @param float $expiry The number of days until expiry
|
||||
* @param string $path The path to save the cookie on (falls back to site base)
|
||||
* @param string $domain The domain to make the cookie available on
|
||||
* @param boolean $secure Can the cookie only be sent over SSL?
|
||||
|
Loading…
Reference in New Issue
Block a user