欢迎来到天天文库
浏览记录
ID:9794131
大小:34.50 KB
页数:4页
时间:2018-05-10
《高洛峰老师的 php 分页类》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、'记录','frist'=>'首页','pre'=>'上一页','next'=>'下一页','fist'=>'首页','last'=>'尾页');publicfunction__construct($total,$eachpagenum,$pa){$this->total=$total;
2、$this->eachpagenum=$eachpagenum;$this->uri=$this->geturi($pa);$this->page=!empty($_GET['page'])?$_GET['page']:1;$this->pagenum=ceil($this->total/$this->eachpagenum);$this->limit=$this->setlimit();}//privatefunctionnowpage(){//if($_GET['page']<=0){//return1;//}elseif($_GET['page']>$this
3、->pagenum){//return$this->pagenum;//}else{//return$_GET['page'];//}//}privatefunctiongeturi($pa){$url=$_SERVER['REQUEST_URI'].(strpos($_SERVER['REQUEST_URI'],"?")?"":"?").$pa;$parse=parse_url($url);if(isset($parse["query"])){parse_str($parse["query"],$params);unset($params["page"]);$ur
4、l=$parse["path"]."?".http_build_query($params);return$url;}else{return$url;}}privatefunctionsetlimit(){return"limit".($this->page-1)*$this->eachpagenum.",{$this->eachpagenum}";}privatefunction__get($args){if($args=="limit"){return$this->limit;}else{returnnull;}}privatefunctionstar(){if
5、($this->total==0){return0;}else{return($this->page-1)*$this->eachpagenum+1;}}privatefunctionend(){returnmin($this->page*$this->eachpagenum,$this->total);}privatefunctioneachpagenum1(){return$this->end()-$this->star()+1;}privatefunctionfrist(){if($this->page==1){$html.=" {$this->co
6、nfig['frist']}";}else{$html.=" uri}&page=1'>{$this->config['frist']}";}return$html;}privatefunctionpre(){if($this->page>1){$html.=" uri}&page=".($this->page-1)."'>{$this->config['pre']}";}else{$html.=" {$this->config['pre']}";}retu
7、rn$html;}privatefunctionpagelist(){$linkpage="";$lastlist=floor($this->listnum/2);for($i=$lastlist;$i>=1;$i--){$page=$this->page-$i;if($page>=1){$linkpage.=" uri}&page={$page}'>{$page}";}else{continue;}}$linkpage.=" {$this->page}";for($i=1;$i<=$lastlist;
此文档下载收益归作者所有