44 lines
2.0 KiB
PHP
44 lines
2.0 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | YwxApp [ WE CAN DO IT JUST ]
|
||
// +----------------------------------------------------------------------
|
||
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
|
||
// +----------------------------------------------------------------------
|
||
// | Author: ywxapp <admin@ywxapp.cn>
|
||
// +----------------------------------------------------------------------
|
||
// | 注意:本文件原先被错误地写入了「缓存(cache)」配置结构,导致 ThinkPHP
|
||
// | 初始化 Session 时拿不到正确的配置,session 的 expire 为 0,File 驱动
|
||
// | read() 的时间检查 `filemtime >= time() - expire` 恒为假,Session 永远
|
||
// | 为空,登录写入的 refresh_token 无法在后续请求中被读取,自动续期失效。
|
||
// | 这里改为正确的 Session 配置。
|
||
// +----------------------------------------------------------------------
|
||
|
||
return [
|
||
// SessionID 前缀(Cookie 名称)
|
||
'prefix' => 'PHPSESSID',
|
||
// 驱动方式
|
||
'type' => 'file',
|
||
// 是否自动启动
|
||
'auto_start' => true,
|
||
// Session 保存路径(留空则使用 runtime_path() . 'session/',backend 应用为 runtime/addon/backend/session/)
|
||
'path' => '',
|
||
// Session 文件生命周期(秒)。
|
||
// 必须大于 access_token 的过期时间,否则用户空闲超过该值后 session 文件
|
||
// 会被判定过期、导致后端自动续期读不到 refresh_token 而失败。
|
||
// 设为 7 天,与 refresh_token 有效期(604800)对齐,支持长时间空闲自动续期。
|
||
'expire' => 604800,
|
||
// 是否压缩数据
|
||
'data_compress' => false,
|
||
// Cookie 域名
|
||
'domain' => '',
|
||
// 仅 HTTPS 传输
|
||
'secure' => false,
|
||
// 仅 HTTP 可见(防 XSS)
|
||
'httponly' => false,
|
||
// 使用 Cookie 传递 SessionID
|
||
'use_cookies' => true,
|
||
// 客户端缓存限制
|
||
'cache_limiter' => 'nocache',
|
||
'cache_expire' => 0,
|
||
];
|