zoukankan      html  css  js  c++  java
  • ThinkPHP5.1数据分页输出

    public function test2()
    {
    //$data=Pzq_article::all();//获取所有
    //$data=Db::table('pzq_article')->select();
    //获取5条分页数据
    $data=Pzq_article::paginate(5);
    //$data=Db::table('pzq_article')->paginate(5);

    $this->view->assign('data',$data);
    return $this->view->fetch();
    }

    ---------------------

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>{$title|default='默认标题'}</title>
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
    <script src="/static/js/jquery-3.3.1.min.js"></script>
    <script src="/static/js/bootstrap.min.js"></script>
    </head>
    <body>
    <div class="container">
    <div class="row">
    <div class='col-md-2'></div>
    <div class='col-md-8'>
    <h2 class="text-center">学生信息</h2>
    <table class="table table-default table-bordered table-hover text-center">
    <tr class="bg-primary">
    <td>ID</td>
    <td>类别ID</td>
    <td>标题</td>
    <td>时间</td>
    </tr>
    {volist name='data' id='list'}
    <tr>
    <td>{$list.id}</td>
    <td>
    {if $list.cat_id==3}
    <span style="color:red">旗舰店</span>
    {else/}
    {$list.cat_id}
    {/if}
    </td>
    <td>{$list.title}</td>
    <td>{$list.add_time|date='Y-m-d'}</td>
    </tr>
    {/volist}

    </table>
    </div>
    <div class='col-md-2'></div>
    <div class="text-center">分页:{$data|raw}</div>
    </div>
    </div>
    </body>
    </html>

  • 相关阅读:
    数组与指针
    壁纸
    2019/1/11
    指针A
    数组B
    一起来抓老鼠啊!快乐呀!
    打印沙漏
    I think I need a boat house
    币值转换
    《C语言程序设计》编程总结汇总
  • 原文地址:https://www.cnblogs.com/samphp/p/8598296.html
Copyright © 2011-2022 走看看