<?php
/**
 * Created by PhpStorm.
 * User: stanley-king
 * Date: 2017/2/5
 * Time: 上午1:01
 */


function sub_callbackx($redis, $chan, $msg)
{
    switch($chan)
    {
        case 'chan-1':
            print "get $msg from $chan\n";
            break;
        case 'chan-2':
            print "get $msg FROM $chan\n";
            break;
        case 'chan-3':
            break;
    }
}

$redis = new Redis();
$redis->pconnect('127.0.0.1',6379);
$redis->subscribe(array('chan-1'), 'sub_callbackx');