Properties

$simple

$simple : bool

是否简洁模式

Type

bool

$items

$items : \think\Collection

数据集

Type

Collection

$currentPage

$currentPage : int

当前页

Type

int

$lastPage

$lastPage : int

最后一页

Type

int

$total

$total : int|null

数据总数

Type

int|null

$listRows

$listRows : int

每页数量

Type

int

$hasMore

$hasMore : bool

是否有下一页

Type

bool

$options

$options : array

分页配置

Type

array

Methods

__construct()

__construct(mixed  $items, mixed  $listRows, mixed  $currentPage = null, mixed  $total = null, mixed  $simple = false, mixed  $options = []) : mixed

Parameters

mixed $items
mixed $listRows
mixed $currentPage
mixed $total
mixed $simple
mixed $options

Returns

mixed —

make()

make( $items,  $listRows, null  $currentPage = null, null  $total = null, bool  $simple = false, array  $options = []) : \think\Paginator

Parameters

$items
$listRows
null $currentPage
null $total
bool $simple
array $options

Returns

\think\Paginator —

getCurrentPage()

getCurrentPage(string  $varPage = 'page', int  $default = 1) : int

自动获取当前页码

Parameters

string $varPage
int $default

Returns

int —

getCurrentPath()

getCurrentPath() : string

自动获取当前的path

Returns

string —

total()

total() : mixed

Returns

mixed —

listRows()

listRows() : mixed

Returns

mixed —

currentPage()

currentPage() : mixed

Returns

mixed —

lastPage()

lastPage() : mixed

Returns

mixed —

hasPages()

hasPages() : bool

数据是否足够分页

Returns

bool —

getUrlRange()

getUrlRange(int  $start, int  $end) : array

创建一组分页链接

Parameters

int $start
int $end

Returns

array —

fragment()

fragment(string|null  $fragment) : $this

设置URL锚点

Parameters

string|null $fragment

Returns

$this —

appends()

appends(array|string  $key, string|null  $value = null) : $this

添加URL参数

Parameters

array|string $key
string|null $value

Returns

$this —

render()

render() : mixed

渲染分页html

Returns

mixed —

items()

items() : mixed

Returns

mixed —

getCollection()

getCollection() : mixed

Returns

mixed —

isEmpty()

isEmpty() : mixed

Returns

mixed —

each()

each(callable  $callback) : $this

给每个元素执行个回调

Parameters

callable $callback

Returns

$this —

getIterator()

getIterator() : \Traversable

Retrieve an external iterator

Returns

\Traversable —

An instance of an object implementing Iterator or Traversable

offsetExists()

offsetExists(mixed  $offset) : bool

Whether a offset exists

Parameters

mixed $offset

Returns

bool —

offsetGet()

offsetGet(mixed  $offset) : mixed

Offset to retrieve

Parameters

mixed $offset

Returns

mixed —

offsetSet()

offsetSet(mixed  $offset, mixed  $value) : mixed

Offset to set

Parameters

mixed $offset
mixed $value

Returns

mixed —

offsetUnset()

offsetUnset(mixed  $offset) : void

Offset to unset

Parameters

mixed $offset

count()

count() : mixed

Count elements of an object

Returns

mixed —

__toString()

__toString() : mixed

Returns

mixed —

toArray()

toArray() : mixed

Returns

mixed —

jsonSerialize()

jsonSerialize() : mixed

Specify data which should be serialized to JSON

Returns

mixed —

__call()

__call(mixed  $name, mixed  $arguments) : mixed

Parameters

mixed $name
mixed $arguments

Returns

mixed —

setCurrentPage()

setCurrentPage(mixed  $currentPage) : mixed

Parameters

mixed $currentPage

Returns

mixed —

url()

url( $page) : string

获取页码对应的链接

Parameters

$page

Returns

string —

buildFragment()

buildFragment() : string

构造锚点字符串

Returns

string —