欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php仿discuz分页效果代码_php技巧

程序员文章站 2024-02-04 13:48:58
...
复制代码 代码如下:

/**
* 显示样式2
*/
function multi($mpurl,$page = 10) {

$multipage = '';
$mpurl .= strpos($mpurl, '?') ? '&' : '?';
$realpages = 1;
if($this->infocount > $this->items) {
$offset = 2;

$realpages = @ceil($this->infocount / $this->items);
$pages = $this->maxpages && $this->maxpages maxpages : $realpages;

if($page > $pages) {
$from = 1;
$to = $pages;
} else {
$from = $this->pageno - $offset;
$to = $from + $page - 1;
if($from $to = $this->pageno + 1 - $from;
$from = 1;
if($to - $from $to = $page;
}
} elseif($to > $pages) {
$from = $pages - $page + 1;
$to = $pages;
}
}

$multipage = ($this->pageno - $offset > 1 && $pages > $page ? '1 ...' : '').
($this->pageno > 1 ? '' : '');
for($i = $from; $i $multipage .= $i == $this->pageno ? '
'.$i.'' :''.$i.'';
}

$multipage .= ($this->pageno pageno + 1).'" class="p_redirect">>>' : '').
($to ... '.$realpages.'' : '').
($pages > $page ? '' : '');

$multipage = $multipage ? '' : '';
}
return $multipage;
}

这是效果:
图片附件:
php仿discuz分页效果代码_php技巧
相关标签: php discuz 分页