将值添加到存储在键处的设定值。
Parameters:
string $key Required key
mixed|string …$value1 Variadic list of values
Returns:
添加到集合中的元素的数量。如果该值已经在集合中,则返回FALSE
Declared in: Redis
Links: https://redis.io/commands/sadd
Source:
S:/Software/JetBrains/PHPStorm/App/PhpStorm-2020.2.1.win/plugins/php/lib/php.jar!/stubs/redis/Redis.phpsAdd on redis.io
<?php//连接本地的 Redis 服务$redis = new Redis();$redis->connect('10.1.3.15', 6379);$redis->auth('kuaicdn_redis_passwd');$redis->flushAll();$ret['exec'][]=$redis->sAdd('gather_test','1111','22222','33333');$ret['src'][]=$redis->sMembers('gather_test');print_r($ret);?>
Array([exec] => Array([0] => 3)[src] => Array([0] => Array([0] => 1111[1] => 22222[2] => 33333)))
