/** * getRedis [reids实例] * @author wangzhiqiang * @param int $id * @return mixed */ public function getRedis($id = 0) { if (empty($this->redis[$id]) || !$this->redis[$id]->info()) { $this->redis[$id] = new \Redis(); $config = Config::get_redis_config(); $res = $this->redis[$id]->connect($config['host'], $config['port']); $this->redis[$id]->auth($config['password']); $this->redis[$id]->select($id); if (!$res) { } } return $this->redis[$id]; }