diff --git a/library/think/Cookie.php b/library/think/Cookie.php index 648b2c60..12b5cc31 100644 --- a/library/think/Cookie.php +++ b/library/think/Cookie.php @@ -99,6 +99,22 @@ class Cookie $_COOKIE[$name] = $value; } + /** + * 永久保存Cookie数据 + * @param string $name cookie名称 + * @param mixed $value cookie值 + * @param mixed $option 可选参数 可能会是 null|integer|string + * @return void + */ + public static function forever($name, $value = '', $option = null) + { + if (is_null($option) || is_numeric($option)) { + $option = []; + } + $option['expire'] = 315360000; + self::set($name, $value, $option); + } + /** * 判断Cookie数据 * @param string $name cookie名称