清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
<?php //可以实现在功能变动时,连接自动更新 class pager{ /* $newPager = new pager(); $newPager->page=1; 起始页 $newPager->pageDisplay=5; 显示页码 $newPager->table="product"; //数据表 echo $newPager->outputPager(); 输出分页 */ var $page; //默认页 var $pageDisplay;//显示页数 var $table;//要分页的表 var $pageNum; function newURL(){ $url = $_SERVER['REQUEST_URI'];//获取URL $explodeUrl = explode("&p=",$url);//分解URL $newURL = $explodeUrl[0]; return $newURL; } function total(){//信息数 $sqlTable = mysql_query("select * from $this->table"); $num = mysql_num_rows($sqlTable); return $num; } function pageNum(){//页数 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(){//下一页 if($_GET['p']!=""){$this->page=$_GET['p']+1;} if($_GET['p'] >= $this->pageNum()){$this->page=$this->pageNum();} return $this->page; } function nextpage(){//上一页 $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'>|首页|</a><li> <li><a href='".$this->newURL()."&p=".$this->nextpage()."'>|上一页|</a></li> <li><a href='".$this->newURL()."&p=".$this->page()."'>|下一页|</a></li> <li><a href='".$this->newURL()."&p=".$this->pageNum."'>|未页|</a></li> <li>".$this->page."/".$this->pageNum()."页</li> <li>共".$this->total()."项</li> </div> "; } } } class area{ } ?>