中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

php智能分頁(yè)類(lèi)代碼

2018-07-20    來(lái)源:open-open

容器云強(qiáng)勢(shì)上線(xiàn)!快速搭建集群,上萬(wàn)Linux鏡像隨意使用
<?php
 //可以實(shí)現(xiàn)在功能變動(dòng)時(shí),連接自動(dòng)更新
 class pager{
 /*
 $newPager = new pager();
 $newPager->page=1; 起始頁(yè)
 $newPager->pageDisplay=5; 顯示頁(yè)碼
 $newPager->table="product"; //數(shù)據(jù)表
 echo $newPager->outputPager(); 輸出分頁(yè)
 */
  
 var $page; //默認(rèn)頁(yè)
 var $pageDisplay;//顯示頁(yè)數(shù)
 var $table;//要分頁(yè)的表
 var $pageNum;
 function newURL(){
 $url = $_SERVER['REQUEST_URI'];//獲取URL
 $explodeUrl = explode("&p=",$url);//分解URL
 $newURL = $explodeUrl[0];
 return $newURL;
 }
 function total(){//信息數(shù)
 $sqlTable = mysql_query("select * from $this->table");
 $num = mysql_num_rows($sqlTable);
 return $num;
 }
 function pageNum(){//頁(yè)數(shù)
 if($this->total()%$this->pageDisplay){
 $this->pageNum = intval($this->total()/$this->pageDisplay)+1;
 }
 else{
 $this->pageNum=$this->total()/$this->pageDisplay;
 }
 return $this->pageNum;
 }
 function page(){//下一頁(yè)
 if($_GET['p']!=""){$this->page=$_GET['p']+1;}
 if($_GET['p'] >= $this->pageNum()){$this->page=$this->pageNum();}
 return $this->page;
 }
 function nextpage(){//上一頁(yè)
 $next = $_GET['p']-1;
 if($next<=0){$next=0;}
 return $next;
 }
 function start(){
 $start = ($this->page()-1)*$this->pageDisplay;
 return $start;
 }
 function outputPager(){
 if($this->pageNum()>1){
 return "<div id='pageDiv'>
 <ul>
 <li><a href='".$this->newURL()."&p=0'>|首頁(yè)|</a><li>
 <li><a href='".$this->newURL()."&p=".$this->nextpage()."'>|上一頁(yè)|</a></li>
 <li><a href='".$this->newURL()."&p=".$this->page()."'>|下一頁(yè)|</a></li>
 <li><a href='".$this->newURL()."&p=".$this->pageNum."'>|未頁(yè)|</a></li>
 <li>".$this->page."/".$this->pageNum()."頁(yè)</li>
 <li>共".$this->total()."項(xiàng)</li>
 </div>
 ";
 }
 }
 }
 class area{
  
 }
 ?>

標(biāo)簽: isp Mysql

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請(qǐng)聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請(qǐng)與原作者聯(lián)系。

上一篇:php文件和圖片上傳類(lèi)

下一篇:OpenCV圖像匹配算法之orb