return [
// session name
'name' => 'PHPSESSID',
// SESSION_ID的提交变量,解决flash上传跨域
'var_session_id' => '',
// 驱动方式 支持file cache
'type' => 'cache',
// 存储连接标识 当type使用cache的时候有效
'store' => 'redis',
// 过期时间
'expire' => 1440,
// 前缀
'prefix' => '',
];
cahce.php代码:<?php
// +----------------------------------------------------------------------
// | 缓存设置
// +----------------------------------------------------------------------
return [
// 默认缓存驱动
'default' => env('cache.driver', 'redis'),
// 缓存连接方式配置
'stores' => [
'file' => [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => '',
// 缓存前缀
'prefix' => '',
// 缓存有效期 0表示永久缓存
'expire' => 0,
// 缓存标签前缀
'tag_prefix' => 'tag:',
// 序列化机制 例如 ['serialize', 'unserialize']
'serialize' => [],
],
// redis缓存
'redis' => [
// 驱动方式
'type' => 'redis',
// 服务器地址
'host' => '127.0.0.1',
],
// 更多的缓存连接
],
];
缓存是能够正常使用的,就是验证码怎么check都是错误,于是我去追踪代码,到:vendor/topthink/think-captcha/src/Captcha.php--》check()方法,打印里面的$this->session->has('captcha'),发现是false,请问这是怎么回事呢?public function check(string $code): bool
{
dd($this->session->has('captcha'));
if (!$this->session->has('captcha')) {
return false;
}
然后我进到redis-cli里面看,redis也确实存入值了:127.0.0.1:6379> get cb1711a883702951fcd45ef0abb3d43b
"s:104:\"a:1:{s:7:\"captcha\";a:1:{s:3:\"key\";s:60:\"$2y$10$MvdW3EV3E494CGGQrjpof.2HoacsiO2OkUDaIjxcJ10Bwdky7dMki\";}}\";"
127.0.0.1:6379>
是我配置的问题?还是说系统这块有bug?最佳答案
