示例代码,供参考:
复制代码 代码如下:
$config = Zend_Registry::get('config');
$host = $config->setting->redis->host;
$port = $config->setting->redis->port;
$redis = new Redis();
$redis->connect($host, $port) or die("connect to redis errorn");
$redis->auth($config->setting->redis->password) or die("auth failedn");
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);