luojie-

 

需要 use think\Page;

我这个是 Page是从tp3.2的移到5.0来用的,如果你的里面没有这个也可以移动过来

PHP代码:

1         $page= $this->request->param(\'page\');
2         $count = count($audit);//数组有多少条记录
3         $p = new Page($count,10,\'\',$page);//10为每页显示的条        数,$page为传过来的页码
4         $pa=($page-1)*10;//计算每页的数据从第几条开始
5         $lists = array_slice($audit,$pa,10);//重组数组
6         $page = $p->show();//传递页码到前端显示
7         $this->assign(\'page\',$page);   //传递页码
8         $this->assign("last",$lists);//传递显示的数据

视图显示代码:

1  <ul class="pagination">{$page|default=\'\'}</ul>

 

效果图:

 

分类:

技术点:

相关文章:

  • 2021-07-17
  • 2022-01-07
  • 2021-11-23
  • 2021-12-22
  • 2021-06-07
  • 2021-10-02
  • 2021-10-02
  • 2021-10-02
猜你喜欢
  • 2021-05-18
  • 2021-10-05
  • 2021-05-19
  • 2021-05-18
  • 2021-03-31
  • 2021-07-05
  • 2021-04-26
相关资源
相似解决方案