获取所有哈希表中的字段
<?php//连接本地的 Redis 服务$redis = new Redis();$redis->connect('10.1.3.15', 6379);$redis->auth('kuaicdn_redis_passwd');$redis->flushAll();$redis->hMSet('hast-test-hmset',array('key1'=>'StringValue','key2'=>256,'key3'=>256.00002,));$ret['cmd']=$redis->hKeys('hast-test-hmset');$ret['src']=$redis->hGetAll('hast-test-hmset');var_dump($ret);//print_r($ret);?>
输出:
array(2) {["cmd"]=>array(3) {[0]=>string(4) "key1"[1]=>string(4) "key2"[2]=>string(4) "key3"}["src"]=>array(3) {["key1"]=>string(11) "StringValue"["key2"]=>string(3) "256"["key3"]=>string(9) "256.00002"}}
值得注意的是, key2 和 key3 输出为字符串类型了
