flower_svr/include/redis.class.php
2021-06-11 16:09:56 +08:00

33 lines
1022 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
//
/****================================
* redis 操作类
* @author ddcai
* @email 252378189@qq.com
* @package: redis.class.php
$c = array(
"port"=>'3306',//端口
"host"=>'127.0.0.1'//主机IP
);
==================================***/
class myredis extends redis{
public function __construct($myhost='REDIS'){
parent::__construct();
if( !isset($GLOBALS[$myhost]['REDIS_HOST']) || !isset($GLOBALS[$myhost]['REDIS_PORT'])){
return false;
}
if($this->connect($GLOBALS[$myhost]['REDIS_HOST'],$GLOBALS[$myhost]['REDIS_PORT'])){
if(!empty($GLOBALS[$myhost]['REDIS_PWD'])){
$this->auth($GLOBALS[$myhost]['REDIS_ID'].':'.$GLOBALS[$myhost]['REDIS_PWD']);
}
//客户端选择第2个表作为存放数据的表第一个表为 0 )
$this->select(REDIS_SELECT_TABLE_PHP);
return true;
}else{
die($this->getLastError());
}
return false;
}
}
?>