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:
Jackson Darlow 2020-09-10 12:34:33 +12:00 committed by GitHub
parent 589631df00
commit 2753f823ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 4 deletions

View File

@ -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.

View File

@ -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

View File

@ -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?

View File

@ -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?