欢迎来到天天文库
浏览记录
ID:24264922
大小:77.01 KB
页数:4页
时间:2018-11-13
《hp完美分页类赋效果》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、"个记录","prev"=>"上一页","next"=>"下一页","first"=>"首页","last"=>"尾页");private$listNum=8;/**$total*$listRows*/publicfunction_
2、_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();}privatefun
3、ctionsetLimit(){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["query"])){parse_str
4、($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->total==0)return0;elsereturn($th
5、is->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->config["first"]} ";return
6、$html;}privatefunctionprev(){if($this->page==1)$html.='';else$html.=" uri}&page=".($this->page-1)."'>{$this->config["prev"]} ";return$html;}privatefunctionpageList(){$linkPage="";$inum=floor($this->listNum/2);for($i
7、=$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->page+$i;if($page<=$this->pageNum)$linkPage.="&n
8、bsp;uri}&page={$page}'>{$page} ";elsebreak;}return$linkPage;}privatefunctionnext(){if($this->page==$this->pageNum)$html.='';else$html.=" uri}&page=".
此文档下载收益归作者所有