该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
$str=$str.$this->commonTag($i);
}
$str=$str.$this->currentTag();
$str=$str.$this->next();
}else {
if ($this->currentPage<6) {
$str=$this->up();
for ($i = 1; $i < $this->currentPage; $i++) {
$str=$str.$this->commonTag($i);
}
$str=$str.$this->currentTag();
for ($i = $this->currentPage+1; $i <= 7; $i++) {
$str=$str.$this->commonTag($i);
}
$str=$str.'...';//添加省略号
$str=$str.$this->commonTag($this->totalPage);
$str=$str.$this->next();
}else {
if ($this->currentPage>=$this->totalPage-4) {
$str=$this->up();
$str=$str.$this->commonTag(1);
$str=$str.'...';//添加省略号
for ($i = $this->totalPage-6; $i < $this->currentPage; $i++) {
$str=$str.$this->commonTag($i);
}
$str=$str.$this->currentTag();
for ($i = $this->currentPage+1; $i <= $this->totalPage; $i++) {
$str=$str.$this->commonTag($i);
}
$str=$str.$this->next();
}elseif ($this->currentPagetotalPage-4){//1+5+1
$str=$this->up();
$str=$str.$this->commonTag(1);
$str=$str.'...';//添加省略号
$str=$str.$this->commonTag($this->currentPage-2);
$str=$str.$this->commonTag($this->currentPage-1);
$str=$str.$this->currentTag();
$str=$str.$this->commonTag($this->currentPage+1);
$str=$str.$this->commonTag($this->currentPage+2);
$str=$str.'...';//添加省略号
$str=$str.$this->commonTag($this->totalPage);
$str=$str.$this->next();
}
};
}
}elseif ($this->totalPage<=0){
throw new Exception("页面不可能小于1");
}
return $str;
}
/**
* 一般标签
* @param int $param 页码
* @return string
*/
function commonTag($param) {
return ''.$param.'';
}
/**
* 生成当前页标签
* @param int $param 页码
* @return string
*/
function currentTag() {
return ''.$this->currentPage.'';
}
/**
* 生成下一页标签
* @param int $param 下一页页码