connect ($host, $port, $this->timeout);// or die('连接失败!'); }catch (\ErrorException $e) { $this->_redis = null; } if (isset($config['password'])) { $password = $config['password']; $redis->auth ($password); } $this->_redis = $redis; $this->expire = 300; } else { $this->_redis = null; } } function get() { return $this->_redis; } }