欢迎来到天天文库
浏览记录
ID:47105649
大小:77.00 KB
页数:4页
时间:2019-08-04
《php完美分页类(赋效果图)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、"个记录","prev"=>"上一页","next"=>"下一页","first"=>"首页","last"=>"尾页");private$listNum=8;/**$total*$listRows*/publicfu
2、nction__construct($total,$listRows=10,$pa=""){$this->total=$total;$this->listRows=$listRows;$this->uri=$this->getUri($pa);$this->page=!empty($_GET["page"])?$_GET["page"]:1;$this->pageNum=ceil($this->total/$this->listRows);$this->limit=$this->setLimit
3、();}privatefunctionsetLimit(){return"Limit".($this->page-1)*$this->listRows.",{$this->listRows}";}privatefunctiongetUri($pa){$url=$_SERVER["REQUEST_URI"].(strpos($_SERVER["REQUEST_URI"],'?')?'':"?").$pa;echo$url;$parse=parse_url($url);if(isset($parse
4、["query"])){parse_str($parse['query'],$params);unset($params["page"]);$url=$parse['path'].'?'.http_build_query($params);}return$url;}privatefunction__get($args){if($args=="limit")return$this->limit;elsereturnnull;}privatefunctionstart(){if($this->tot
5、al==0)return0;elsereturn($this->page-1)*$this->listRows+1;}privatefunctionend(){returnmin($this->page*$this->listRows,$this->total);}privatefunctionfirst(){if($this->page==1)$html.='';else$html.=" uri}&page=1'>{$this->confi
6、g["first"]} ";return$html;}privatefunctionprev(){if($this->page==1)$html.='';else$html.=" uri}&page=".($this->page-1)."'>{$this->config["prev"]} ";return$html;}privatefunctionpageList(){$linkPa
7、ge="";$inum=floor($this->listNum/2);for($i=$inum;$i>=1;$i--){$page=$this->page-$i;if($page<1)continue;$linkPage.=" uri}&page={$page}'>{$page} ";}$linkPage.=" {$this->page} ";for($i=1;$i<=$inum;$i++){$page=$this
8、->page+$i;if($page<=$this->pageNum)$linkPage.=" uri}&page={$page}'>{$page} ";elsebreak;}return$linkPage;}privatefunctionnext(){if($this->page==$this->pageNum)$html.='';else$html.=" uri}&page=".
此文档下载收益归作者所有