mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 15:42:48 +08:00
cookie类httponly参数默认改为false
This commit is contained in:
@@ -22,7 +22,7 @@ class Cookie
|
|||||||
'path' => '/', // cookie 保存路径
|
'path' => '/', // cookie 保存路径
|
||||||
'domain' => '', // cookie 有效域名
|
'domain' => '', // cookie 有效域名
|
||||||
'secure' => false, // cookie 启用安全传输
|
'secure' => false, // cookie 启用安全传输
|
||||||
'httponly' => '', // httponly 设置
|
'httponly' => false, // httponly 设置
|
||||||
'setcookie' => true, // 是否使用 setcookie
|
'setcookie' => true, // 是否使用 setcookie
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -39,7 +39,9 @@ class Cookie
|
|||||||
*/
|
*/
|
||||||
public static function init(array $config = [])
|
public static function init(array $config = [])
|
||||||
{
|
{
|
||||||
if (empty($config)) $config = Config::get('cookie');
|
if (empty($config)) {
|
||||||
|
$config = Config::get('cookie');
|
||||||
|
}
|
||||||
|
|
||||||
self::$config = array_merge(self::$config, array_change_key_case($config));
|
self::$config = array_merge(self::$config, array_change_key_case($config));
|
||||||
|
|
||||||
@@ -58,7 +60,9 @@ class Cookie
|
|||||||
*/
|
*/
|
||||||
public static function prefix($prefix = '')
|
public static function prefix($prefix = '')
|
||||||
{
|
{
|
||||||
if (empty($prefix)) return self::$config['prefix'];
|
if (empty($prefix)) {
|
||||||
|
return self::$config['prefix'];
|
||||||
|
}
|
||||||
|
|
||||||
return self::$config['prefix'] = $prefix;
|
return self::$config['prefix'] = $prefix;
|
||||||
}
|
}
|
||||||
@@ -120,7 +124,9 @@ class Cookie
|
|||||||
*/
|
*/
|
||||||
public static function forever($name, $value = '', $option = null)
|
public static function forever($name, $value = '', $option = null)
|
||||||
{
|
{
|
||||||
if (is_null($option) || is_numeric($option)) $option = [];
|
if (is_null($option) || is_numeric($option)) {
|
||||||
|
$option = [];
|
||||||
|
}
|
||||||
|
|
||||||
$option['expire'] = 315360000;
|
$option['expire'] = 315360000;
|
||||||
|
|
||||||
@@ -163,7 +169,10 @@ class Cookie
|
|||||||
$value = [];
|
$value = [];
|
||||||
|
|
||||||
foreach ($_COOKIE as $k => $val) {
|
foreach ($_COOKIE as $k => $val) {
|
||||||
if (0 === strpos($k, $prefix)) $value[$k] = $val;
|
if (0 === strpos($k, $prefix)) {
|
||||||
|
$value[$k] = $val;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$value = $_COOKIE;
|
$value = $_COOKIE;
|
||||||
@@ -216,7 +225,9 @@ class Cookie
|
|||||||
*/
|
*/
|
||||||
public static function clear($prefix = null)
|
public static function clear($prefix = null)
|
||||||
{
|
{
|
||||||
if (empty($_COOKIE)) return;
|
if (empty($_COOKIE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
!isset(self::$init) && self::init();
|
!isset(self::$init) && self::init();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user