Requests_Cookie::is_expired()
最后更新于:2021-11-26 01:07:20
Requests_Cookie::is_expired()Check if a cookie is expired.
响应
(boolean) True if expired, false if time is valid.
源文件
文件: gc-includes/Requests/Cookie.php
public function is_expired() {
// RFC6265, s. 4.1.2.2:
// If a cookie has both the Max-Age and the Expires attribute, the Max-
// Age attribute has precedence and controls the expiration date of the
// cookie.
if (isset($this->attributes['max-age'])) {
$max_age = $this->attributes['max-age'];
return $max_age < $this->reference_time;
}
if (isset($this->attributes['expires'])) {
$expires = $this->attributes['expires'];
return $expires < $this->reference_time;
}
return false;
}