tihinkphp自带的分页类样式,有时不能满足项目的要求,这里主要介绍一下,分页类样式的定制和美化,使其更简洁、美观thinkphp5控制器写法
   function index($keyword='', $page = 1){
        $map = [];
        if ($keyword) {
            $map['code'] = ['like', "%{$keyword}%"];
        }
        $list=Db('package')->where($map)->paginate(10, false, ['page' => $page]);
        return $this->fetch('index',['list'=>$list,'keyword'=>$keyword]);
    }模板写法
/*循环输出数据*/ 
  {foreach $list as $vo}
      id {$vo.id}
   {/foreach}
/*分页写法*/ 
  {$list->render()}分页样式
<style>
/*分页*/
.pagination {}
.pagination li {display: inline-block;margin-right: -1px;padding: 5px;border: 1px solid #e2e2e2;min-width: 20px;text-align: center;}
.pagination li.active {background: #009688;color: #fff;border: 1px solid #009688;}
.pagination li a {display: block;text-align: center;}
</style>以上就是thinkphp5分页样式,tp5分页样式的详细内容,更多请关注php中文网其它相关文章!
 
                        
                        PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
 
                 
                                
                                 收藏
收藏
                                                                            ![ThinkPHP5实战之[教学管理系统]](https://img.php.cn/upload/course/000/000/068/6253d87459486427.png) 
                                
                                 收藏
收藏
                                                                             
                                
                                 收藏
收藏
                                                                            Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号