Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql F3(无脂肪框架)DB\Cursor->;以一种奇怪的方式行事_Mysql_Sql_Pagination_Fat Free Framework - Fatal编程技术网

Mysql F3(无脂肪框架)DB\Cursor->;以一种奇怪的方式行事

Mysql F3(无脂肪框架)DB\Cursor->;以一种奇怪的方式行事,mysql,sql,pagination,fat-free-framework,Mysql,Sql,Pagination,Fat Free Framework,我使用的是无脂肪框架的DB Cursor类中的paginate方法,但从代码上看,有些东西我无法理解 $mapper->paginate([ int $pos = 0 ], [ int $size = 10 ], [ string|array $filter = NULL ], [ array $options = NULL ]); 看起来,$pos参数应该是查询结果中的偏移量,$size参数是结果请求的长度。我说得对吗 我的问题来了 为什么在fatfreeframework/db/cu

我使用的是无脂肪框架的DB Cursor类中的
paginate
方法,但从代码上看,有些东西我无法理解

$mapper->paginate([ int $pos = 0 ], [ int $size = 10 ], [ string|array $filter = NULL ], [ array $options = NULL ]);
看起来,
$pos
参数应该是查询结果中的偏移量,
$size
参数是结果请求的长度。我说得对吗

我的问题来了

为什么在
fatfreeframework/db/cursor.php的
第89行的代码中
偏移量定义为
$pos*$size

如果我调用
$mapper->paginate(52,10)
我希望看到从第52条开始的10条记录,而不是从第520条开始的10条记录

我错过什么了吗

我应该像使用页码一样使用
$pos
参数吗


谢谢

是的,$pos var是指页码偏移量。如果将其设置为52,则将根据页面大小(限制)获得第52页,如paginate的名称所示。 如果您只想在查询中使用偏移量和限制,可以使用类似于
$mapper->find(数组('foo>1')、数组('limit'=>10、'offset'=>520))相当于第52页的页码