diff --git a/library/think/cache/driver/Redisd.php b/library/think/cache/driver/Redisd.php index f4ac7281..dbfdafad 100644 --- a/library/think/cache/driver/Redisd.php +++ b/library/think/cache/driver/Redisd.php @@ -200,6 +200,7 @@ class Redisd { $this->master(false); + $value = null; try { $value = $this->handler->get($this->options['prefix'] . $name); } catch (\RedisException $e) { diff --git a/library/think/session/driver/Redis.php b/library/think/session/driver/Redis.php index 23bdfb77..b07289dd 100644 --- a/library/think/session/driver/Redis.php +++ b/library/think/session/driver/Redis.php @@ -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->config['timeout'] > 0 ? - $this->handler->$func($this->config['host'], $this->config['port'], $this->config['timeout']) : - $this->handler->$func($this->config['host'], $this->config['port']); + $this->handler->$func($this->config['host'], $this->config['port'], $this->config['timeout']); + if ('' != $this->config['password']) { $this->handler->auth($this->config['password']); }