33 lines
1022 B
PHP
33 lines
1022 B
PHP
<?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;
|
||
}
|
||
}
|
||
?>
|