• 分页表


    <?php 
    
        //引入model类
        include './Model.php';
        //实例化对象
        $mod = new Model('user');
    
        //获取总数据
        $count = $mod->count();
    
        //引入page类
        include './Page.php';
    
        $page = new Page($count,5);
    
        $limit = $page->getLimit();
    
        $show = $page->show();
    
        $res = $mod->limit($limit)->select();
        //echo '<pre>';
        ///var_dump($res);
    
    
    
     ?>
     <!DOCTYPE html>
     <html lang="en">
     <head>
         <meta charset="UTF-8">
         <title>Document</title>
         <style type="text/css">
        table{
            width:400px;
            height:300px;
            border:solid 1px blue;
            border-collapse:collapse;
        }
    
        table td{
    
            text-align:center;
        }
    
        #page {
            margin-top:10px;
        }
        #page a{
    
            text-decoration:none;
            margin-right:5px;
        }
    
         </style>
     </head>
     <body>
         <center>
         <table border='1'>
             <caption><h2>学生信息表</h2></caption>
             <tr>
                 <th>ID</th> <th>用户名</th> <th>密码</th> <th>年龄</th> 
             </tr>
            
            <?php 
                foreach($res as $k => $v) {
            ?>
                <tr>
                    <td><?php echo $v['id']?></td>
                    <td><?= $v['username']?></td>
                    <td><?= $v['password']?></td>
                    <td><?= $v['age']?></td>
                </tr>
            
            <?php
            }
            ?>
         </table>
            
            <div id='page'>
                <?=
                    $show;
                ?>
            </div>
            
    
         </center>
     </body>
     </html>
  • 相关阅读:
    凸包模板
    F
    luogu P1220 关路灯
    [国家集训队]小Z的袜子
    [AHOI2009]维护序列
    luogu P3373 【模板】线段树 2
    [国家集训队]数颜色 / 维护队列
    luogu P3393 逃离僵尸岛
    [Usaco2005 Mar]Out of Hay 干草危机
    [USACO07NOV]牛栏Cow Hurdles
  • 原文地址:https://www.cnblogs.com/xujing6/p/6270919.html
Copyright © 2020-2023  润新知