php-paginator分页处理类
<?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记录页。
免责声明
本站所有资源均由网友贡献或各大下载网站转载。请自行检查软件的完整性!本站所有资源仅供学习参考。请不要将它们用于商业目的。否则,一切后果由您负责!如有侵权,请联系我们删除。联系方式:admin@php.cn
相关文章

20 Jan 2025
SQL Server 中的分页:LIMIT 和 OFFSET 的替代方案PostgreSQL 的 LIMIT 和 OFFSET 语法可实现高效的结果集分页......

21 Oct 2024
在 PHP 中使用 BigInteger 类 PHP 提供了多种处理大整数值的方法。 BigInteger 类就是这样的选项之一。访问 BigInteger 类 BigInteger 类在 PHP 中本身并不可用。但是,您可以使用外部库


Hot Tools

热门文章
丢失记录:Bloom&Rage -Corey和Dylan的锁组合
19 Feb 2025
手游攻略
Longvinter:完整的钓鱼指南
21 Feb 2025
手游攻略
王国来:拯救2-婚礼要买的衣服
05 Feb 2025
手游攻略
王国来:拯救2-如何获得Comfrey
07 Feb 2025
手游攻略
Hello Kitty Island冒险:重新启动机器人任务演练
16 Feb 2025
手游攻略