Properties

$simple

$simple : boolean

是否简洁模式

Type

boolean

$items

$items : \think\Collection

数据集

Type

\think\Collection

$currentPage

$currentPage : integer

当前页

Type

integer

$lastPage

$lastPage : integer

最后一页

Type

integer

$total

$total : integer|null

数据总数

Type

integer|null

$listRows

$listRows : integer

每页数量

Type

integer

$hasMore

$hasMore : boolean

是否有下一页

Type

boolean

$options

$options : array

分页配置

Type

array

$currentPageResolver

$currentPageResolver : \Closure

获取当前页码

Type

\Closure

$currentPathResolver

$currentPathResolver : \Closure

获取当前路径

Type

\Closure

$maker

$maker : \Closure

Type

\Closure

Methods

__construct()

__construct(  $items, \think\int  $listRows, \think\int  $currentPage = 1, \think\int  $total = null, \think\bool  $simple = false, array  $options = array()) 

Parameters

$items
\think\int $listRows
\think\int $currentPage
\think\int $total
\think\bool $simple
array $options

make()

make(mixed  $items, integer  $listRows, integer  $currentPage = 1, integer  $total = null, boolean  $simple = false, array  $options = array()) : \think\Paginator

Parameters

mixed $items
integer $listRows
integer $currentPage
integer $total
boolean $simple
array $options

Returns

\think\Paginator

maker()

maker(\Closure  $resolver) 

Parameters

\Closure $resolver

getCurrentPage()

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

自动获取当前页码

Parameters

string $varPage
integer $default

Returns

integer

currentPageResolver()

currentPageResolver(\Closure  $resolver) 

设置获取当前页码闭包

Parameters

\Closure $resolver

getCurrentPath()

getCurrentPath(string  $default = '/') : string

自动获取当前的path

Parameters

string $default

Returns

string

currentPathResolver()

currentPathResolver(\Closure  $resolver) 

设置获取当前路径闭包

Parameters

\Closure $resolver

total()

total() 

listRows()

listRows() 

currentPage()

currentPage() 

lastPage()

lastPage() 

hasPages()

hasPages() : boolean

数据是否足够分页

Returns

boolean

getUrlRange()

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

创建一组分页链接

Parameters

integer $start
integer $end

Returns

array

fragment()

fragment(string|null  $fragment = null) : $this

设置URL锚点

Parameters

string|null $fragment

Returns

$this

appends()

appends(array  $append) : $this

添加URL参数

Parameters

array $append

Returns

$this

render()

render() : mixed

渲染分页html

Returns

mixed

items()

items() 

getCollection()

getCollection() : \think\Collection|\think\model\Collection

获取数据集

Returns

\think\Collection|\think\model\Collection

isEmpty()

isEmpty() 

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) : boolean

Whether a offset exists

Parameters

mixed $offset

Returns

boolean

offsetGet()

offsetGet(mixed  $offset) : mixed

Offset to retrieve

Parameters

mixed $offset

Returns

mixed

offsetSet()

offsetSet(mixed  $offset, mixed  $value) 

Offset to set

Parameters

mixed $offset
mixed $value

offsetUnset()

offsetUnset(mixed  $offset) : void

Offset to unset

Parameters

mixed $offset

count()

count() 

Count elements of an object

__toString()

__toString() 

toArray()

toArray() 

jsonSerialize()

jsonSerialize() 

Specify data which should be serialized to JSON

__call()

__call(  $name,   $arguments) 

Parameters

$name
$arguments

setCurrentPage()

setCurrentPage(\think\int  $currentPage) 

Parameters

\think\int $currentPage

url()

url(integer  $page) : string

获取页码对应的链接

Parameters

integer $page

Returns

string

buildFragment()

buildFragment() : string

构造锚点字符串

Returns

string