$page = 1;
$total = 20;
$prevs = $page - 4;
if($prevs $prevs = 1;
}
$next = $page + 4;
if($next > $total) {
$next = $total;
}
for($i = $prevs; $i <= $page - 1; $i++) {
echo $i."rn";
}
echo '['.$page.']'."rn";
for($i = $page + 1; $i echo $i."rn";
}
本文http://www.cxybl.com/html/wlbc/Php/20130504/37473.html