作者:瀟湘博客

時(shí)間: 2009-11-26

php技術(shù)群: 37304662

使用方法: include_once'Pager.class.php'; $pager=new Pager(); if(isset($_GET['page'])) $pager->setCurrentPage($_GET['p " /> 2020年国产精品午夜福利在线观看 ,久久这里只有精品国产精品99 ,湖南张丽大战黑人hd视频

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

php google或baidu分頁(yè)代碼

復(fù)制代碼 代碼如下:
<?php
/**

作者:瀟湘博客

時(shí)間:
2009-11-26

php技術(shù)群:
37304662

使用方法:
include_once'Pager.class.php';
$pager=new Pager();
if(isset($_GET['page']))
$pager->setCurrentPage($_GET['page']);
else
$pager->setCurrentPage(1);

$pager->setRecorbTotal(1000);
$pager->setBaseUri("page.php?");
echo $pager->execute();

**/
class Pager{
/**
*int總頁(yè)數(shù)
**/
protected $pageTotal;
/**
*int
**/
protected $previous;
/**
*int
**/
protected $next;
/**
*int中間頁(yè)起始序號(hào)
**/
protected $startPage;
/**
*int中間頁(yè)終止序號(hào)
**/
protected $endPage;
/**
*int記錄總數(shù)
**/
protected $recorbTotal;
/**
*int每頁(yè)顯示記錄數(shù)
**/
protected $pageSize;
/**
*int當(dāng)前顯示頁(yè)
**/
protected $currentPage;
/**
*string基url地址
**/
protected $baseUri;

/**
*@returnstring獲取基url地址
*/
public function getBaseUri(){
return$this->baseUri;
}

/**
*@returnint獲取當(dāng)前顯示頁(yè)
*/
public function getCurrentPage(){
return $this->currentPage;
}

/**
*@returnint獲取每頁(yè)顯示記錄數(shù)
*/
public function getPageSize(){
return $this->pageSize;
}

/**
*@returnint獲取記錄總數(shù)
*/
public function getRecorbTotal(){
return$this->recorbTotal;
}

/**
*@paramstring$baseUri設(shè)置基url地址
*/
public function setBaseUri($baseUri){
$this->baseUri=$baseUri;
}

/**
*@paramint$currentPage設(shè)置當(dāng)前顯示頁(yè)
*/
public function setCurrentPage($currentPage){
$this->currentPage=$currentPage;
}

/**
*@paramint$pageSize設(shè)置每頁(yè)顯示記錄數(shù)
*/
public function setPageSize($pageSize){
$this->pageSize=$pageSize;
}

/**
*@paramint$recorbTotal設(shè)置獲取記錄總數(shù)
*/
public function setRecorbTotal($recorbTotal){
$this->recorbTotal=$recorbTotal;
}

/**
*構(gòu)造函數(shù)
**/
public function __construct()
{
$this->pageTotal=0;
$this->previous=0;
$this->next=0;
$this->startPage=0;
$this->endPage=0;

$this->pageSize=20;
$this->currentPage=0;
}

/**
*分頁(yè)算法
**/
private function arithmetic(){
if($this->currentPage<1)
$this->currentPage=1;

$this->pageTotal=floor($this->recorbTotal/$this->pageSize)+($this->recorbTotal%$this->pageSize>0?1:0);

if($this->currentPage>1&&$this->currentPage>$this->pageTotal)
header('location:'.$this->baseUri.'page='.$this->pageTotal);

$this->next=$this->currentPage+1;
$this->previous=$this->currentPage-1;

$this->startPage=($this->currentPage+5)>$this->pageTotal?$this->pageTotal-10:$this->currentPage-5;
$this->endPage=$this->currentPage<5?11:$this->currentPage+5;

if($this->startPage<1)
$this->startPage=1;

if($this->pageTotal<$this->endPage)
$this->endPage=$this->pageTotal;
}

/**
*分頁(yè)樣式
**/


protected function pageStyle(){
$result="共".$this->pageTotal."頁(yè)";

if($this->currentPage>1)
$result.="<a href=/"".$this->baseUri."page=1/"><font style=/"font-family:webdings/">第1頁(yè)</font></a> <a href=/"".$this->baseUri."page=$this->previous/"><fontstyle=/"font-family:webdings/">前一頁(yè)</font></a>";
else
$result.="<font style=/"font-family:webdings/">第1頁(yè)</font> <font style=/"font-family:webdings/"></font>";

for($i=$this->startPage;$i<=$this->endPage;$i++){
if($this->currentPage==$i)
$result.="<font color=/"#ff0000/">$i</font>";
else
$result.=" <a href=/"".$this->baseUri."page=$i/">$i</a> ";
}

if($this->currentPage!=$this->pageTotal){
$result.="<a href=/"".$this->baseUri."page=$this->next/"><font style=/"font-family:webdings/">后一頁(yè)</font></a> ";
$result.="<a href=/"".$this->baseUri."page=$this->pageTotal/"><font style=/"font-family:webdings/">最后1頁(yè)</font></a>";
}else{
$result.="<font style=/"font-family:webdings/">最后1頁(yè)</font> <font style=/"font-family:webdings/"></font>";
}
return $result;
}



/**
*執(zhí)行分頁(yè)
**/
public function execute(){
if($this->baseUri!=""&&$this->recorbTotal==0)
return"";
$this->arithmetic();
return $this->pageStyle();
}
}
?>

php技術(shù)php google或baidu分頁(yè)代碼,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 伊人久久大香线蕉无码麻豆 | 国产精品99久久久久久AV蜜臀 | 国产麻豆精品久久一二三 | 日日噜噜噜夜夜爽爽狠狠 | 亚洲三级在线观看 | 中文字幕绝色少妇性 | 69精品人人人人 | 无码内射成人免费喷射 | 尤物yw193can入口 | 欧美xxxxx18| 亚洲国产精品VA在线看黑人 | 抽插内射高潮呻吟V杜V | 97色色极品av影院 | 久久婷婷色香五月综合激情 | 欧美精品乱码99久久蜜桃 | NANANA在线观看高清影院 | av天堂网2017avtt | 亚洲AV久久无码精品国产网站 | 天天射天天爱天天干 | 欧美日韩精品一区二区三区高清视频 | 国产av在线播放 | 国产成人一区二区三区在线观看 | 国产亚洲精品久久久久久一区二区 | 黄色软件视频app | 男人都懂www深夜免费网站 | 伊人影院久久 | 亚洲成人99 | 亚洲 天堂 欧美 日韩 国产 | 亚洲理论片在线中文字幕 | 扒开屁股眼往里面夹东西 | gay台湾无套男同志xnxⅹ | 国产睡熟迷奷系列精品 | yin乱教师系列合集 yin荡体育课羞耻play双性 | 夜夜躁婷婷AV蜜桃视频 | 精品国产5g影院天天爽 | 视频区 国产 欧美 日韩 | 亚洲午夜福利未满十八勿进 | 国产手机在线精品 | 99久久精品国产免费 | 欧美日韩高清一区二区三区 | 国产在线伊人 |