예제 #1
0
파일: iredis.php 프로젝트: zuozuoba/zpf
 public static function getInstance()
 {
     if (!iredis::$instance) {
         self::$instance = new iredis();
     }
     return self::$instance;
 }
예제 #2
0
파일: QQ.php 프로젝트: zuozuoba/zpf
 public function __construct($callback_url, $cookierand)
 {
     $config = Config::$qq;
     $this->appid = $config['appid'];
     $this->appkey = $config['appkey'];
     $this->scope = $config['scope'];
     $this->state_pre = $config['state_pre'];
     $this->callback = $callback_url ? $callback_url : $config['callback_url'];
     $this->cookierand = $cookierand;
     $this->objRedis = iredis::getInstance();
 }
예제 #3
0
 */
require_once 'iredis.php';
function judge($status, $cmd)
{
    if ($status == 0 || $status == true) {
        echo "<br/>";
        echo $cmd . " success.";
    } else {
        echo "<br/>";
        echo $cmd . " failed.";
        var_dump($status);
    }
}
echo "<br/>";
echo "下面为测试redis的php接口类iredis的各种命令.";
$rf = new iredis();
$ipaddr = '192.168.122.10';
$port = 7000;
$status = $rf->configure($ipaddr, $port);
if ($rf->getStatus()) {
    echo "<br/>";
    echo "connect server success";
} else {
    echo "<br/>";
    echo "connect server:port ({$ipaddr}:{$port}) failed.";
    return;
}
$status = $rf->set('lenovo', 'shanghai777');
judge($status, "set");
# $status=$rf->del('lenovo');
# judge($status, "del");
예제 #4
0
파일: index.php 프로젝트: zuozuoba/zpf
 public function getAnhao()
 {
     $anhao = $this->G('anhao');
     $coords = $this->G('coords');
     $objRdis = iredis::getInstance();
     $objRdis->ihset($anhao, $this->cookierand, $coords);
     $arrCoords = $objRdis->hvals($anhao);
     exit(json_encode($arrCoords));
 }
예제 #5
0
파일: WeChat.php 프로젝트: zuozuoba/zpf
 public function getTextOfVoice()
 {
     $username = $this->getData('username');
     exit(iredis::getInstance()->getWeixinVoice($username));
 }
예제 #6
0
for ($i = 0; $i < $rows; $i++) {
    $tab_str .= "<tr>\n";
    $row_i = $data[$i];
    for ($k = 0; $k < $cols; $k++) {
        $tab_str .= "<td width=\"{$td_width}\">{$row_i[$k]}</td>\n";
    }
    $tab_str .= "</tr>\n";
}
$tab_str .= "</table>\n <br/>";
#echo "name  *  id  *  title <br/>";
#echo $_SERVER['DOCUMENT_ROOT'];
$image = "test.jpg";
echo "<br/>";
echo '<img src="' . $image . '" height ="100"/><br />';
print $tab_str;
#echo "<p/>";
#var_dump($data);
echo "<br/>";
echo "<br/>";
echo "<br/>";
echo "<br/>";
echo "<br/>";
echo "<br/>";
echo "<br/>";
echo "follow test redis:";
$redis = new iredis();
$result = $redis->configure('127.0.0.1', 6379);
#var_dump($result); //结果:bool(true)
#$redis->set('test', 'hello world!');
#$redis->select(1);
echo $redis->get('test');
예제 #7
0
<?php

/***
 * use to test the clasee redis_face.php
 */
require_once 'iredis.php';
function judge($status, $cmd)
{
    if ($status == 0 || $status == true) {
        echo "<p class=\"lead\">";
        echo $cmd . " success.";
        echo "<p/>";
    } else {
        echo "<p class=\"lead\">";
        echo $cmd . " failed.";
        echo "<p/>";
        #        var_dump($status);
    }
}
echo "<h1>下面为测试redis的php接口类iredis的各种命令.</h1>";
$rf = new iredis();
$status = $rf->set('lenovo', 'shanghai');
judge($status, "set");
$status = $rf->del('lenovo');
judge($status, "del");
$status = $rf->hset('go', 'shanghai', 'e2e2');
judge($status, "hset");
$status = $rf->delete('go');
judge($status, "delete");