1 ){
$pre = '
上一页';
}
if( $page < $page_all ){
$next = '下一页';
}
if( $page_all <= 11 ){
/* 小于等于 11 页 */
$left_num = $page - 1;
$right_num = $page_all - $page;
}else{
if( $page > 6 ){
$left_more = true;
if( $page < $page_all - 5 ){
$right_more = true;
$left_num = 4;
$right_num = 4;
}else{
$right_more = false;
$right_num = $page_all - $page;
$left_num = 9 - $right_num;
}
}else{
$left_num = $page - 1;
$left_more = false;
$right_num = 9 - $left_num;
$right_more = true;
}
}
if( $left_more ){
$middle .= '1';
$middle .= '...';
}
for($j=$left_num;$j>0;$j--){
$i = $page - $j;
if( $i <= 0 ){
continue;
}
$middle .= '' . $i .'';
}
$middle .= '' . $page . '';
for($j=1;$j<=$right_num;$j++){
$i = $page + $j;
if( $i > $page_all ){
continue;
}
$middle .= '' . $i .'';
}
if( $right_more ){
$middle .= '...';
$middle .= '' . $page_all .'';
}
return $pre.$middle.$next;
}