将值添加到存储在键处的设定值。

    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.php
    sAdd on redis.io

    1. <?php
    2. //连接本地的 Redis 服务
    3. $redis = new Redis();
    4. $redis->connect('10.1.3.15', 6379);
    5. $redis->auth('kuaicdn_redis_passwd');
    6. $redis->flushAll();
    7. $ret['exec'][]=$redis->sAdd('gather_test','1111','22222','33333');
    8. $ret['src'][]=$redis->sMembers('gather_test');
    9. print_r($ret);
    10. ?>
    1. Array
    2. (
    3. [exec] => Array
    4. (
    5. [0] => 3
    6. )
    7. [src] => Array
    8. (
    9. [0] => Array
    10. (
    11. [0] => 1111
    12. [1] => 22222
    13. [2] => 33333
    14. )
    15. )
    16. )