在线工具
网站地图    收藏    合作   
<

快捷菜单 返回顶部

php操作redis

返回上层

Set数据类型函数 - sInter - 命令/方法/函数

Returns the members of a set resulting from the intersection of all the sets held at the specified keys. If just a single key is specified, then this command produces the members of this set. If one of the keys is missing, FALSE is returned.

返回指定SETS集合的交集结果。如果只是指定了一个SET集合,那么返回该SET集合。如果在参数中有参数错误,那么则返回FLASE。


Parameters

key1, key2, keyN: keys identifying the different sets on which we will apply the intersection.

参数列表,代表不同的SET集合。


Return value

Array, contain the result of the intersection between those keys. If the intersection beteen the different sets is empty, the return value will be empty array.

返回数组,数组中的结果为所有SET集合的交集。如果所涉及到的SET集合没有交集结果,那么将返回一个空数组。


Examples

$redis->sAdd('key1', 'val1');

$redis->sAdd('key1', 'val2');

$redis->sAdd('key1', 'val3');

$redis->sAdd('key1', 'val4');


$redis->sAdd('key2', 'val3');

$redis->sAdd('key2', 'val4');


$redis->sAdd('key3', 'val3');

$redis->sAdd('key3', 'val4');


var_dump($redis->sInter('key1', 'key2', 'key3'));


Output:

array(2) {

  [0]=>

  string(4) "val4"

  [1]=>

  string(4) "val3"

}


来源:https://www.daixiaorui.com/

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com