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
相关文章
SQL Server 如何处理没有 LIMIT 和 OFFSET 的分页?
20 Jan 2025
SQL Server 中的分页:LIMIT 和 OFFSET 的替代方案PostgreSQL 的 LIMIT 和 OFFSET 语法可实现高效的结果集分页......
如何使用 PHP 中的 BigInteger 类处理大整数?
21 Oct 2024
在 PHP 中使用 BigInteger 类 PHP 提供了多种处理大整数值的方法。 BigInteger 类就是这样的选项之一。访问 BigInteger 类 BigInteger 类在 PHP 中本身并不可用。但是,您可以使用外部库
Hot Tools
热门文章
崩坏:星穹铁道 - 所有金色替罪羊谜题解决方案
18 Jan 2025
手游攻略
Tales Of Graces F 重制版:所有锁定的宝箱密码
18 Jan 2025
手游攻略
鲁马岛:考古学家职业指南
03 Jan 2025
手游攻略
如何修复 KB5049622 在 Windows 11 中安装失败的问题?
15 Jan 2025
故障排查
鲁玛岛:所有鲁玛蛋地点
05 Jan 2025
手游攻略