您的位置 首页 php

PHP连接含Redis密码验证、指定某一Redis数据库

<?php

$ redis = new Redis();

$redis->connect(‘127.0.0.1’, 6379); //连接Redis

$redis->auth(‘mypasswords123sdfeak’); //密码验证

$redis->select(2);//选择数据库2

$redis->set( “testKey” , “Hello Redis”); //设置测试key

echo $redis->get(“testKey”);//输出value

?>

文章来源:智云一二三科技

文章标题:PHP连接含Redis密码验证、指定某一Redis数据库

文章地址:https://www.zhihuclub.com/150109.shtml

关于作者: 智云科技

热门文章

网站地图