Returns the contents of a set.
返回SET集合中的所有元素。
Parameters
Key: key
Return value
An array of elements, the contents of the set.
Example
$redis->delete('s');
$redis->sAdd('s', 'a');
$redis->sAdd('s', 'b');
$redis->sAdd('s', 'a');
$redis->sAdd('s', 'c');
var_dump($redis->sMembers('s'));
Output:
array(3) {
[0]=>
string(1) "c"
[1]=>
string(1) "a"
[2]=>
string(1) "b"
}
The order is random and corresponds to redis' own internal representation of the set structure.
结果集的顺序是随机的,这也符合Redis本身对SET数据结构的定义。不重复,无顺序的集合。