PHP函数查看redis 版本号
【摘要】
$redis_ext_refc = new ReflectionExtension('redis');var_dump($redis_ext_refc->getVersion());
参考:
public function addServer($host = '127.0.0.1', $port = 6379, $dbInde...
$redis_ext_refc = new ReflectionExtension('redis');
var_dump($redis_ext_refc->getVersion());
参考:
public function addServer($host = '127.0.0.1', $port = 6379, $dbIndex = 0, $weight = 1) {
$redis = new Redis();
$rhost = $host . ':' . $port;
$connection_string = $rhost . '/' . $dbIndex;
$redis_ext_refc = new ReflectionExtension('redis');
if (version_compare($redis_ext_refc->getVersion(), '2.1.0') <= 0) {
$bret = $redis->pconnect($host, $port, 0);
} else {
$bret = $redis->pconnect($host, $port, 0, $connection_string);
}
if ($bret) {
// $redis->select($dbIndex); // redis-proxy and high redis not support this anymore
$this->_hash->addTarget($rhost);
$this->_pool[$rhost] = $redis;
return true;
}
unset($redis);
return false;
}
文章来源: blog.csdn.net,作者:lxw1844912514,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/lxw1844912514/article/details/121616029
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)