flatphp / pagination
light pagination component
v1.0.0
2020-02-12 09:06 UTC
Requires
- php: >=5.5
This package is auto-updated.
Last update: 2024-12-08 20:19:50 UTC
README
light pagination component
简单分页组件
Install
composer require flatphp/pagination
Usage
use Flatphp\Pagination\Paginator; $page = 16; $p = new Paginator(1506, $page); $p->getNext(); // ... // or specify page_size or specify page style, default sliding,others: all, elastic, jumping // 配置每页数量,以及分页样式 $p = new Paginator(1506, $page, ['page_size' => 30, 'style' => 'jumping']); $a = $p->toArray(); print_r($a);
Style
Methods
toArray
Array
(
[page] => 16
[page_size] => 20
[total] => 1506
[page_count] => 76
[page_range] => 10
[has_prev] => 1
[has_next] => 1
[prev] => 15
[next] => 17
[range] => Array
(
[0] => 11
[1] => 12
[2] => 13
[3] => 14
[4] => 15
[5] => 16
[6] => 17
[7] => 18
[8] => 19
[9] => 20
)
)