ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## sMembers, sGetMembers ##### *Description* Returns the contents of a set. 返回SET集合中的所有元素。 ##### *Parameters* *Key*: key ##### *Return value* An array of elements, the contents of the set. ##### *Example* ``` <pre class="calibre16">$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: ``` <pre class="calibre16">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数据结构的定义。不重复,无顺序的集合。