mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
取消 url_module_map 配置参数 改进Redis session驱动
This commit is contained in:
@@ -73,8 +73,6 @@ return [
|
||||
'url_route_on' => true,
|
||||
// 是否强制使用路由
|
||||
'url_route_must' => false,
|
||||
// URL模块映射
|
||||
'url_module_map' => [],
|
||||
// 域名部署
|
||||
'url_domain_deploy' => false,
|
||||
// 域名根,如.thinkphp.cn
|
||||
|
||||
@@ -18,13 +18,13 @@ class Redis extends SessionHandler
|
||||
{
|
||||
protected $handler = null;
|
||||
protected $config = [
|
||||
'host' => '127.0.0.1', // redis主机
|
||||
'port' => 6379, // redis端口
|
||||
'password' => '', // 密码
|
||||
'expire' => 3600, // 有效期(秒)
|
||||
'timeout' => 0, // 超时时间(秒)
|
||||
'persistent' => true, // 是否长连接
|
||||
'session_name' => '', // sessionkey前缀
|
||||
'host' => '127.0.0.1', // redis主机
|
||||
'port' => 6379, // redis端口
|
||||
'password' => '', // 密码
|
||||
'expire' => 3600, // 有效期(秒)
|
||||
'timeout' => 0, // 超时时间(秒)
|
||||
'persistent' => true, // 是否长连接
|
||||
'session_name' => '', // sessionkey前缀
|
||||
];
|
||||
|
||||
public function __construct($config = [])
|
||||
@@ -45,11 +45,11 @@ class Redis extends SessionHandler
|
||||
throw new Exception('_NOT_SUPPERT_:redis');
|
||||
}
|
||||
$this->handler = new \Redis;
|
||||
|
||||
|
||||
// 建立连接
|
||||
$func = $this->config['persistent'] ? 'pconnect' : 'connect';
|
||||
$this->handler->$func($this->config['host'], $this->config['port'], $this->config['timeout']);
|
||||
|
||||
|
||||
if ('' != $this->config['password']) {
|
||||
$this->handler->auth($this->config['password']);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ class Redis extends SessionHandler
|
||||
*/
|
||||
public function destroy($sessID)
|
||||
{
|
||||
return $this->handler->delete($this->config['session_name'] . $sessID);
|
||||
return $this->handler->delete($this->config['session_name'] . $sessID) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user