PHP Class think\Paginator

Show file Open project: top-think/framework

Protected Properties

Property Type Description
$currentPage 当前页
$hasMore 是否有下一页
$items 数据集
$lastPage 最后一页
$listRows 每页的数量
$options 一些配置
$simple 是否为简洁模式
$total 数据总数

Public Methods

Method Description
appends ( array | string $key, string | null $value = null ) 添加URL参数
currentPage ( )
fragment ( string | null $fragment ) 设置URL锚点
getCurrentPage ( string $varPage = 'page', integer $default = 1 ) : integer 自动获取当前页码
getCurrentPath ( ) : string 自动获取当前的path
getUrlRange ( integer $start, integer $end ) : array 创建一组分页链接
hasPages ( ) : boolean 数据是否足够分页
lastPage ( )
listRows ( )
make ( $items, $listRows, null $currentPage = null, null $total = null, boolean $simple = false, array $options = [] ) : Collection
render ( ) : mixed 渲染分页html
total ( )

Protected Methods

Method Description
__construct ( $items, $listRows, $currentPage = null, $total = null, $simple = false, $options = [] )
buildFragment ( ) : string 构造锚点字符串
setCurrentPage ( $currentPage )
url ( $page ) : string 获取页码对应的链接

Method Details

__construct() protected method

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

appends() public method

添加URL参数
public appends ( array | string $key, string | null $value = null )
$key array | string
$value string | null

buildFragment() protected method

构造锚点字符串
protected buildFragment ( ) : string
return string

currentPage() public method

public currentPage ( )

fragment() public method

设置URL锚点
public fragment ( string | null $fragment )
$fragment string | null

getCurrentPage() public static method

自动获取当前页码
public static getCurrentPage ( string $varPage = 'page', integer $default = 1 ) : integer
$varPage string
$default integer
return integer

getCurrentPath() public static method

自动获取当前的path
public static getCurrentPath ( ) : string
return string

getUrlRange() public method

创建一组分页链接
public getUrlRange ( integer $start, integer $end ) : array
$start integer
$end integer
return array

hasPages() public method

数据是否足够分页
public hasPages ( ) : boolean
return boolean

lastPage() public method

public lastPage ( )

listRows() public method

public listRows ( )

make() public static method

public static make ( $items, $listRows, null $currentPage = null, null $total = null, boolean $simple = false, array $options = [] ) : Collection
$items
$listRows
$currentPage null
$total null
$simple boolean
$options array
return think\paginator\Collection

render() abstract public method

渲染分页html
abstract public render ( ) : mixed
return mixed

setCurrentPage() protected method

protected setCurrentPage ( $currentPage )

total() public method

public total ( )

url() protected method

获取页码对应的链接
protected url ( $page ) : string
$page
return string

Property Details

$currentPage protected property

当前页
protected $currentPage

$hasMore protected property

是否有下一页
protected $hasMore

$items protected property

数据集
protected $items

$lastPage protected property

最后一页
protected $lastPage

$listRows protected property

每页的数量
protected $listRows

$options protected property

一些配置
protected $options

$simple protected property

是否为简洁模式
protected $simple

$total protected property

数据总数
protected $total