Files
shopxo/config/session.php

50 lines
1.9 KiB
PHP
Raw Normal View History

2020-11-15 20:34:18 +08:00
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
2021-03-16 10:34:52 +08:00
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
2020-11-15 20:34:18 +08:00
// +----------------------------------------------------------------------
2021-03-16 10:34:52 +08:00
// | Licensed ( https://opensource.org/licenses/mit-license.php )
2020-11-15 20:34:18 +08:00
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
2021-07-18 23:42:10 +08:00
// +----------------------------------------------------------------------
2026-06-02 16:15:31 +08:00
// | 会话设置(有效期读取后台 系统配置 → Session配置默认 43200 秒)
2021-07-18 23:42:10 +08:00
// +----------------------------------------------------------------------
2026-06-02 16:15:31 +08:00
$session_expire = (int) MyFileConfig('common_session_expire', '', 43200, true);
if($session_expire < 0)
{
$session_expire = 43200;
}
2021-07-18 23:42:10 +08:00
if(MyFileConfig('common_session_is_use_cache', '', 0, true) == 1)
2020-11-15 20:34:18 +08:00
{
// redis配置
2021-07-18 23:42:10 +08:00
// 请确保缓存配置文件cache.php中的stores中已经添加了redis缓存配置
2020-11-15 20:34:18 +08:00
$config = [
2024-04-15 10:35:58 +08:00
'type' => 'cache',
'store' => 'redis',
'prefix' => MyFileConfig('common_cache_session_redis_prefix', '', 'shopxo', true),
2026-06-02 16:15:31 +08:00
// 服务端 Session 数据有效期(秒)
'expire' => $session_expire,
2020-11-15 20:34:18 +08:00
];
} else {
// 默认配置
$config = [
2021-07-18 23:42:10 +08:00
// session name
2024-04-15 10:35:58 +08:00
'name' => 'PHPSESSID',
2020-11-15 20:34:18 +08:00
// SESSION_ID的提交变量,解决flash上传跨域
2024-04-15 10:35:58 +08:00
'var_session_id' => '',
2021-07-18 23:42:10 +08:00
// 驱动方式 支持file cache
2024-04-15 10:35:58 +08:00
'type' => 'file',
2021-07-18 23:42:10 +08:00
// 存储连接标识 当type使用cache的时候有效
2024-04-15 10:35:58 +08:00
'store' => null,
2026-06-02 16:15:31 +08:00
// 服务端 Session 数据有效期(秒)
'expire' => $session_expire,
2021-07-18 23:42:10 +08:00
// 前缀
2024-04-15 10:35:58 +08:00
'prefix' => 'shopxo',
2020-11-15 20:34:18 +08:00
];
}
return $config;
?>