<?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: 페이지당 레코드 수.
이 사이트의 모든 리소스는 네티즌이 제공하거나 주요 다운로드 사이트에서 재인쇄되었습니다. 소프트웨어의 무결성을 직접 확인하십시오! 이 사이트의 모든 리소스는 학습 참고용으로만 사용됩니다. 상업적 목적으로 사용하지 마시기 바랍니다. 그렇지 않으면 모든 결과에 대한 책임은 귀하에게 있습니다! 침해가 있는 경우 당사에 연락하여 삭제하시기 바랍니다. 연락처: admin@php.cn
관련 기사

05 Jan 2025
정수 나누기에 대한 페이지 매김 페이지 계산페이지 매김 방식으로 데이터를 표시할 때 페이지 수를 결정하는 것이 중요합니다...

02 Nov 2024
큰 테이블을 사용하여 검색 결과에 대한 페이지 매김 최적화광범위한 테이블로 작업할 때 페이지 매김 최적화는...

16 Jan 2025
OFFSET 없는 효율적인 페이지 매김: 키 세트 페이지 매김 수용 엄청난 양의 데이터가 포함된 테이블을 작업할 때 페이지 매김이 필수적입니다....

29 Jul 2016
PHP 페이징 탐색: PHP 페이징 탐색 mysql php 페이징 클래스(테스트됨): 코드는 다음과 같습니다. <?php /* mysql_pager.class.php 세 개의 매개변수. mysql_query()의 결과, url 변수 페이지, 원하는 페이지당 레코드 수는 이 파일의 맨 아래에 있습니다. 단수이 리버사이드 테스트 완료 */ class mysql_pager { // 속성 정의


Hot Tools
