效果图function user_ShowListMorePage($num,$page,$dolink,$type,$totalpage,$line,$ok,$search=""){
global $fun_r,$public_r;
if($num<=$line)
{
$pager['showpage']='';
return $pager;
}
$page_line=$public_r['listpagelistnum'];
$snum=2;
//上一页
if($page<>1)
{
$toppage='<li class="page-item"><a href="'.$dolink.'index'.$type.'" class="page-link disabled">'.$fun_r['startpage'].'</a></li>'; //首页
$pagepr=$page-1;
if($pagepr==1)
{
$prido="index".$type;
}
else
{
$prido="index_".$pagepr.$type;
}
$prepage='<li class="page-item"><a href="'.$dolink.$prido.'" class="page-link disabled">'.$fun_r['pripage'].'</a></li>'; //上一页
}
//下一页
if($page!=$totalpage)
{
$pagenex=$page+1;
$nextpage='<li class="page-item"><a href="'.$dolink.'index_'.$pagenex.$type.'" class="page-link disabled">'.$fun_r['nextpage'].'</a></li>'; //下一页
$lastpage='<li class="page-item"><a href="'.$dolink.'index_'.$totalpage.$type.'" class="page-link disabled">'.$fun_r['lastpage'].'</a></li>'; //最后一页
}
$starti=$page-$snum<1?1:$page-$snum;
$no=0;
for($i=$starti;$i<=$totalpage&&$no<$page_line;$i++) //详细页码信息
{
$no++;
if($page==$i)
{
$is_1="<li class='page-item active'><a class='page-link'>"; //当前
$is_2="</a></li>";
}
elseif($i==1)
{
$is_1='<li class="page-item"><a class="page-link" href="'.$dolink.'index'.$type.'">'; //第一页
$is_2="</a></li>";
}
else
{
$is_1='<li class="page-item"><a class="page-link" href="'.$dolink.'index_'.$i.$type.'">'; //其他页
$is_2="</a></li>";
}
$returnstr.=$is_1.$i.$is_2;
}
$returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
$pager['showpage']=$returnstr;
return $pager;
}
css代码用的是bootstrap4默认样式,若需要请单独提炼,也可用现场<div class="row">
<div class="col-md-12 text-center mb-3">
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item"><a href="/xueyuan/index.html" class="page-link disabled">首页</a></li><li class="page-item"><a href="/xueyuan/index.html" class="page-link disabled">上一页</a></li><li class="page-item"><a class="page-link" href="/xueyuan/index.html">1</a></li><li class="page-item active"><a class="page-link">2</a></li>
</ul>
</nav>
</div>
</div>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.5.0/css/bootstrap.min.css">