大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
]>
*/
class phpredis extends Redis{
public function connect($config){
$host = $config['host'];
$port = $config['port'];
parent::connect($host,$port);
$pass = @$config['pass']?:false;
if($pass !== false){
parent::auth($pass);
}
return $this;
}
}
$config = array(
'host'=>'192.168.8.81',
'port'=>'6379',
'pass'=>'123456'
);
$redis = new phpredis();
$redis->connect($config);
$redis->set('name','dollarphp');
$ret = $redis->get('name');
var_dump($ret);
string(9) "dollarphp"