On this page
Requests_Cookie::__construct( string $name, string $value, array|Requests_Utility_CaseInsensitiveDictionary $attributes = array(), $flags = array(), $reference_time = null )
Create a new cookie object
Parameters
$namestring Required$valuestring Required$attributesarray|Requests_Utility_CaseInsensitiveDictionary Optional-
Associative array of attribute data
Default:
array()
Source
File: wp-includes/Requests/Cookie.php. View all references
public function __construct($name, $value, $attributes = array(), $flags = array(), $reference_time = null) {
$this->name = $name;
$this->value = $value;
$this->attributes = $attributes;
$default_flags = array(
'creation' => time(),
'last-access' => time(),
'persistent' => false,
'host-only' => true,
);
$this->flags = array_merge($default_flags, $flags);
$this->reference_time = time();
if ($reference_time !== null) {
$this->reference_time = $reference_time;
}
$this->normalize();
}
Related
Uses
| Uses | Description |
|---|---|
| Requests_Cookie::normalize() wp-includes/Requests/Cookie.php | Normalize cookie and attributes |
Used By
| Used By | Description |
|---|---|
| Requests_Cookie::parse() wp-includes/Requests/Cookie.php | Parse a cookie string into a cookie object |
| WP_Http::normalize_cookies() wp-includes/class-wp-http.php | Normalizes cookies for using in Requests. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/requests_cookie/__construct