怎么实现分页按钮类似于这样,写出了个代码

不能传截图,类似下边的

共15页,到第【】页上一页1 2…6 7 8 9 10…13 14下一页

代码

@if($users->currentPage() == 1)
<a class="prev disabled" href="javascript:void(0);">上一页</a>
@else
<a class="prev" href="{!! $users->url($users->currentPage()-1) !!}">上一页</a>
@endif
@for ($i = 1; $i < $users->lastPage(); $i++)
@if($i<=2 || ($users->lastPage()-$i)<=2)
@if($i == $users->currentPage())
<a class="active" href="javascript:void(0);">{$i}</a>
@else
<a href="{!! $users->url($i) !!}">{$i}</a>
@endif
@else
@if(abs($users->currentPage()-$i) <3)
@if($i == $users->currentPage())
<a class="active" href="javascript:void(0);">{$i}</a>
@else
<a href="{!! $users->url($i) !!}">{$i}</a>
@endif
@else
@if($i == 3 || ($users->lastPage()-$i) == 3)
<span>…</span>
@endif
@endif
@endif
@endfor
@if($users->lastPage() == $users->currentPage())
<a class="next disabled" href="javascript:void(0);">下一页</a>
@else
<a class="next" href="{!! $users->nextPageUrl() !!}">下一页</a>
@endif
sswowo
修改的评论也不能少于六个字哦!