ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## lRem, lRemove ##### *Description* Removes the first `<span class="calibre12">count</span>` occurences of the value element from the list. If count is zero, all the matching elements are removed. If count is negative, elements are removed from tail to head. IRem,IRemove函数,首先要去判断count参数,如果count参数为0,那么所有符合删除条件的元素都将被移除。如果count参数为整数,将从左至右删除count个符合条件的元素,如果为负数则从右至左删除count个符合条件的元素。 **Note**: The argument order is not the same as in the Redis documentation. This difference is kept for compatibility reasons. 函数参数的顺序不一定要一致,这样做是为了保持兼容性。 ##### *Parameters* *key* *value* *count* ##### *Return value* *LONG* the number of elements to remove *BOOL*`<span class="calibre12">FALSE</span>` if the value identified by key is not a list. ##### *Example* ``` <pre class="calibre16">$redis->lPush('key1', 'A'); $redis->lPush('key1', 'B'); $redis->lPush('key1', 'C'); $redis->lPush('key1', 'A'); $redis->lPush('key1', 'A'); $redis->lRange('key1', 0, -1); /* array('A', 'A', 'C', 'B', 'A') */ $redis->lRem('key1', 'A', 2); /* 2 */ $redis->lRange('key1', 0, -1); /* array('C', 'B', 'A') */ ``` ##