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
相關文章
php oracle 分頁類別_PHP教程
21 Jul 2016
php oracle 分頁類別。 example.php 複製程式碼如下: ?php $conn = ociplogon("test","123456","test123"); include_once "pager.inc.php"; ? 複製程式碼如下: ?php /** 分頁測試開始*/ /
實現分十頁分向前十頁向後十頁的處理_PHP教程
21 Jul 2016
實現分十頁分向前十頁向後十頁的處理。 ?/*====對資料的記錄進行分頁顯示 ===== 一張頁面有連續的十個頁面的連接一頁可顯示$limit_row筆記錄資訊並有下十頁和上十頁翻頁功能====
Hot Tools
熱門文章
崩壞:星穹鐵道 - 所有金色替罪羊謎題解決方案
18 Jan 2025
手游攻略
Tales Of Graces F 重製版:所有鎖定的寶箱密碼
18 Jan 2025
手游攻略
如何修復 KB5049622 在 Windows 11 中安裝失敗的問題?
15 Jan 2025
故障排查
魯瑪島:所有魯瑪蛋地點
05 Jan 2025
手游攻略
Haikyuu傳奇風格指南:完整列表和最佳選擇
25 Jan 2025
手游攻略