国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

PHP分頁類

2024-09-04 11:44:00
字體:
來源:轉載
供稿:網友
  1. <?php 
  2. // 禁止直接訪問該頁面 
  3. if (basename($HTTP_SERVER_VARS['PHP_SELF']) == "pager.class.php") { 
  4.    header("HTTP/1.0 404 Not Found"); 
  5.  
  6. class Pager 
  7.    /** 總信息數 */ 
  8.    var $infoCount
  9.    /** 總頁數 */ 
  10.    var $pageCount
  11.    /** 每頁顯示條數 */ 
  12.    var $items
  13.    /** 當前頁碼 */ 
  14.    var $pageNo
  15.    /** 查詢的起始位置 */ 
  16.    var $startPos
  17.    var $nextPageNo
  18.    var $prevPageNo
  19.   
  20.    function Pager($infoCount$items$pageNo
  21.    { 
  22.      $this->infoCount = $infoCount
  23.      $this->items   = $items
  24.      $this->pageNo  = $pageNo
  25.      $this->pageCount = $this->GetPageCount(); 
  26.      $this->AdjustPageNo(); 
  27.      $this->startPos = $this->GetStartPos(); 
  28.    } 
  29.    function AdjustPageNo() 
  30.    { 
  31.      if($this->pageNo == '' || $this->pageNo < 1) 
  32.        $this->pageNo = 1; 
  33.      if ($this->pageNo > $this->pageCount) 
  34.        $this->pageNo = $this->pageCount; 
  35.    } 
  36.    /** 
  37.    * 下一頁 
  38.    */ 
  39.    function GoToNextPage() 
  40.    { 
  41.      $nextPageNo = $this->pageNo 1; 
  42.      if ($nextPageNo > $this->pageCount) 
  43.      { 
  44.        $this->nextPageNo = $this->pageCount; 
  45.        return false; 
  46.      } 
  47.      $this->nextPageNo = $nextPageNo
  48.      return true; 
  49.    } 
  50.    /** 
  51.    * 上一頁 
  52.    */ 
  53.    function GotoPrevPage() 
  54.    { 
  55.      $prevPageNo = $this->pageNo - 1; 
  56.      if ($prevPageNo < 1) 
  57.      { 
  58.        $this->prevPageNo = 1; 
  59.        return false; 
  60.      } 
  61.      $this->prevPageNo = $prevPageNo
  62.      return true; 
  63.    } 
  64.    function GetPageCount() 
  65.    { 
  66.      return ceil($this->infoCount / $this->items); 
  67.    } 
  68.    function GetStartPos() 
  69.    { 
  70.      return ($this->pageNo - 1) * $this->items; 
  71.    } 
  72. ?> 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乡宁县| 方正县| 定结县| 永吉县| 凤庆县| 宁远县| 武山县| 荥经县| 肇东市| 兴隆县| 楚雄市| 定西市| 淳安县| 鄂温| 平果县| 宜川县| 青神县| 九龙城区| 德格县| 当涂县| 如皋市| 洞口县| 通榆县| 收藏| 胶州市| 明水县| 阳原县| 武隆县| 江城| 靖边县| 通化县| 汪清县| 万源市| 九台市| 舒城县| 察雅县| 毕节市| 新干县| 尉氏县| 分宜县| 连江县|