WireInputDataCookie::options()
Get or set cookie options
- Omit all arguments to get current options.
- Specify string for $key (and omit $value) to get the value of one option.
- Specify both $key and $value arguments to set one option.
- Specify associative array for $key (and omit $value) to set multiple options.
Options you can get or set:
age(int): Max age of cookies in seconds or 0 to expire with session. For example: 3600=1 hour, 86400=1 day, 604800=1 week, 2592000=30 days, etc. Note that the default may be overridden by$config->cookieOptionssetting from your /site/config.php file. Default:86400expire(int|string): If you prefer to use an expiration date rather than theageoption, specify a unix timestamp (int), ISO-8601 date string, or any date string recognized by PHP’s strtotime(), like "2020-11-03" or +1 WEEK", etc. Default:null Please note the expire option was added in 3.0.159, previous versions should use theageoption only.path(string|null): Cookie path/URL or null for PW installation’s root URL. Default:nullsecure(bool|null): Transmit cookies only over secure HTTPS connection? Specify true or false, or use null to auto-detect, which uses true for cookies set when HTTPS is detected. Default:nullhttponly(bool): When true, cookie is visible to PHP/ProcessWire only and not visible to client-side JS code. Default:falsefallback(bool): If set cookie fails (perhaps due to output already sent), attempt to set at beginning of next request? Default:truedomain(string|bool|null): Cookie domain, specify one of the following:nullor blank string for current hostname [default], booleantruefor all subdomains of current domain,domain.comfor domain.com and *.domain.com [same as true],www.domain.comfor www subdomain and and hostnames off of it, like dev.www.domain.com. Default:null, current hostname
Available since version 3.0.141.
Usage
// basic usage
$string = $wireInputDataCookie->options();
// usage with all arguments
$string = $wireInputDataCookie->options($key = null, $value = null);Arguments
| Name | Type(s) | Description |
|---|---|---|
$key (optional) | string array null | |
$value (optional) | string array int float null |
Return value
string array int float null this
WireInputDataCookie methods and properties
API reference based on ProcessWire core version 3.0.253