在线工具
网站地图    收藏    合作   
<

快捷菜单 返回顶部

php操作redis

返回上层

zSet数据类型函数 - zRange - 命令/方法/函数

Returns a range of elements from the ordered set stored at the specified key, with values in the range [start, end]. start and stop are interpreted as zero-based indices: 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ...

取得特定范围内的排序元素,0代表第一个元素,1代表第二个以此类推。-1代表最后一个,-2代表倒数第二个...


Parameters

key

start: long

end: long

withscores: bool = false


Return value

Array containing the values in specified range.


Example

$redis->zAdd('key1', 0, 'val0');

$redis->zAdd('key1', 2, 'val2');

$redis->zAdd('key1', 10, 'val10');

$redis->zRange('key1', 0, -1); /* array('val0', 'val2', 'val10') */


// with scores

$redis->zRange('key1', 0, -1, true); /* array('val0' => 0, 'val2' => 2, 'val10' => 10) */


来源:https://www.daixiaorui.com/

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com