作者:琴瑟_0203 | 来源:互联网 | 2023-10-14 15:15
分页显示:--urlFormat:.list.php?page;systemwilladdthePagenumaftertheUrlautomaticly$Id:spl
// 分页显示:[1]… [<<] – [<] [9] [10] [11] [12] [13] [14] [15] [16] [>] – [>>] …[232]
// url Format: ./list.php?page= ; system will add the Pagenum after the Url automaticly
// $Id: split_page.php,v 1.1.1.1 2002/08/24 14:26:41 hightman Exp $
function split_page($url, $total, $curpage = 1, $perpage = 15, $perlist = 8) {
if ($total <= 0) return;
http://www.gaodaima.com/46608.html通用分页函数 split_page()_php
if ($curpage <= 0) $curpage = 1;
$totalpage = ceil($total / $perpage);
$totallist = ceil($totalpage / $perlist);
if ($curpage > $totalpage) $curpage = $totalpage;
$curlist = ceil($curpage / $perlist);
$toppage = $curlist * $perlist;
if ($toppage > $totalpage) $toppage = $totalpage;
$botpage = ($curlist – 1) * $perlist + 1;
if ($botpage <1) $botpage = 1;
$ret = ”;
if ($curlist > 1) {
$ret .= “[1]…/n”;
$ret .= “[<<] -/n”;
}
if ($curpage > 1)
$ret .= “[<]/n”;
do {
if ($botpage == $curpage)
$ret .= “[” . $botpage . “]/n”;
else
$ret .= “[” . $botpage . “]/n”;
} while ($botpage++ <$toppage);
if ($totalpage > $curpage)
$ret .= “[>]/n”;
if ($totallist > $curlist) {
$ret .= “- [>>]/n”;
$ret .= “…[” . $totalpage . “]/n”;
}
$ret .= “Total: ” . $total;
return ($ret);
}
欢迎大家阅读《通用分页函数 split_page()_php》,跪求各位点评,若觉得好的话请收藏本文,by