//更简单的逻辑显示分页条
//$total: 总页数, $showPage: 要显示的页数, $page: 当前页
$start = 1;
$end = $total;
if($total > $showPage){
if($page > 2) $start = $page - 2;
if($page < $total - 2) $end = $page + 2;
while($end - $start < 4){
if($start ==1) $start++;
if($end==$total) $end--;
}
}
//$total: 总页数, $showPage: 要显示的页数, $page: 当前页
$start = 1;
$end = $total;
if($total > $showPage){
if($page > 2) $start = $page - 2;
if($page < $total - 2) $end = $page + 2;
while($end - $start < 4){
if($start ==1) $start++;
if($end==$total) $end--;
}
}