13 Star 137 Fork 35

陈某某 / duckphp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Component-Pager.md 1.57 KB
一键复制 编辑 原始数据 按行查看 历史
陈某某 提交于 2023-11-22 15:00 . 调文档

DuckPhp\Component\Pager

[toc]

简介

组件类 分页类 符合接口 DuckPhp\Component\PagerInterface

选项

全部选项

    'url' => null,

分页,给定 url

    'current' => null,

分页,当前页码

    'page_size' => 30,

分页,每页长度

    'page_key' => 'page',

分页,默认分页的key

    'rewrite' => null,

分页,重写函数,替代 本类的 defaultGetUrl

方法

组件方法

public static function PageNo($new_value = null)

public static function PageWindow($new_value = null)

public static function PageHtml($total, $options = [])

public function __construct()

public function init(array $options, object $context = null)

PagerInterface 方法

public function current($new_value = null): int

public function pageSize($new_value = null): int

public function render($total, $options = []): string

其他方法

public function getPageCount($total): int

获得当前总页数

public function getUrl($page)

根据页码ID获得 URL

public function defaultGetUrl($page)

默认的获得 URL 的方法

内部方法

protected function initOptions(array $options)

protected function initContext(object $context)

protected function getDefaultUrl()

protected function getDefaultPageNo()

详解

Pager 类并没有像其他扩展那样初始化,而是在调用 App::Pager() 的时候 得到类。

Page 在 render($total, $options = []) 的时候会初始化一遍

App::Pager 得到的就是这个类

PHP
1
https://gitee.com/dvaknheo/duckphp.git
git@gitee.com:dvaknheo/duckphp.git
dvaknheo
duckphp
duckphp
master

搜索帮助