php-paginator分页处理类

2017-12-23 14:44:285501356查看评论(19)
简介:

<?php
namespace JasonGrimes;
class Paginator
{
    const NUM_PLACEHOLDER = '(:num)';
    protected $totalItems;
    protected $numPages;
    protected $itemsPerPage;
    protected $currentPage;
    protected $urlPattern;
    protected $maxPagesToShow = 10;
    protected $previousText = 'Previous';
    protected $nextText = 'Next';
    /**
     * @param int $totalItems The total number of items.
     * @param int $itemsPerPage The number of items per page.
     * @param int $currentPage The current page number.
     * @param string $urlPattern A URL for each page, with (:num) as a placeholder for the page number. Ex. '/foo/page/(:num)'
     */
    public function __construct($totalItems, $itemsPerPage, $currentPage, $urlPattern = '')
    {
        $this->totalItems = $totalItems;
        $this->itemsPerPage = $itemsPerPage;
        $this->currentPage = $currentPage;
        $this->urlPattern = $urlPattern;
        $this->updateNumPages();
    }

函数1:根据总页数,当前页,和页分组及url产生分页导航,分页函数参数列表(有多少页,当前页,每页多少个 ,链接地址)。函数2:根据记录数,页列清数,$page,当前页;$row_num记录总数;$pagesize:每页记录数;$url记录页。

php-paginator分页处理类

申明:本站所有资源都是转载各大下载站,或由网友投稿发布,请自行检测软件的完整性,如有侵权请联系我们删除下架,联系方式:admin@php.cn

上一页:
下一页:
o(╯□╰)o到头了
网页评论
最新评论
人间惆怅客
A.杰
  • A.杰
  • 网友评论没有分页吗网友评论没有分页吗网友评论没有分页吗网友评论没有分页吗
  • 2019-05-22 11:46:39发表+0回复
痴货
  • 痴货
  • 要素的三大第三方男麦克雷水电费年
  • 2019-05-19 16:51:35发表+0回复
当下最好
メ落尽丶天涯
一笑二过
phpcn_u87310
LerTong
特产只有烧饼
seven
  • seven
  • 是的撒打开降落伞快乐大几岁来看待
  • 2019-03-28 11:20:13发表+0回复
梦惊禅
Mini
  • Mini
  • 可以的 不错。
  • 2019-03-18 12:01:25发表+0回复
嘸訁
  • 嘸訁
  • 要是有预览效果就更好了'
  • 2019-03-16 21:34:41发表+0回复
千寻
  • 千寻
  • PHP学习最好的网站
  • 2019-03-12 13:59:12发表+0回复
痞子蔡