Properties

$simple

$simple : boolean

是否简洁模式

Type

boolean

$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

Methods

__construct()

__construct(  $items,   $listRows,   $currentPage = null,   $total = null,   $simple = false,   $options = array()) 

Parameters

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

make()

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

Parameters

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

Returns

\think\Paginator

getCurrentPage()

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

自动获取当前页码

Parameters

string $varPage
integer $default

Returns

integer

getCurrentPath()

getCurrentPath() : string

自动获取当前的path

Returns

string

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) : $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() 

getCollection()

getCollection() 

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(  $currentPage) 

Parameters

$currentPage

url()

url(  $page) : string

获取页码对应的链接

Parameters

$page

Returns

string

buildFragment()

buildFragment() : string

构造锚点字符串

Returns

string