当前位置:Gxlcms > PHP教程 > 新手提问分页类的一个输出循环显示分页遇到有关问题,求解

新手提问分页类的一个输出循环显示分页遇到有关问题,求解

时间:2021-07-01 10:21:17 帮助过:9人阅读

新手提问分页类的一个输出循环显示分页遇到问题,求解?

class PageClass {
private $total_record;//总记录
private $page_size;//页记录数
private $current_page;//当前页
private $total_page_size;//总页数
private $page_url; //页面url
private $page_start; //起始页
private $page_stop;//结束页
public $page_limit; //limit,
function __construct($total_record=0,$page_size=1,$current_page=1,$page_url) {
$this->total_record=$this->numeric($total_record);
$this->page_size=$this->numeric($page_size);
$this->current_page=$this->numeric($current_page);
$this->page_limit=($this->current_page*$this->page_size)-$this->page_size;
$this->page_url=$page_url;
if($this->current_page<1){
$this->current_page=1;
}

if($this->current_page<0){
$this->current_page=0;
}
$total_page_size = ceil($total_record/$page_size);

if($this->total_page_size<1){
$this->total_page_size=1;
}
if($this->current_page>$this->total_page_size){
$this->crrent_page=$this->total_page_size;
}
$this->page_start=$this->current_page;
$this->page_stop=$this->current_page+5;
if($this->page_stop>$this->total_page_size){
$this->page_stop=$this->total_page_size;
$this->page_start=$this->page_stop-5;
}
if($this->page_start<1){
$this->page_start=1;
if($this->page_stop > $this->total_page_size){
$this->page_stop=$this->total_page_size;
}

人气教程排行