博主信息
博文 53
粉丝 4
评论 3
访问量 49759
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
php0530TP框架分页显示数据
有点凉了
原创
1177人浏览过


实例

<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/31 0031
 * Time: 下午 2:42
 */
namespace app\index\model;
use think\Model;
class StaffModel extends Model
{
    protected $table = 'staff';
    protected $pk = 'staff_id';
}

运行实例 »

点击 "运行实例" 按钮查看在线实例

实例

{load href="/static/bootstrap/css/bootstrap.css"}
{load href="/static/jquery/jquery.js"}
{load href="/static/bootstrap/js/bootstrap.min.js"}
<style>
    h3 {
        text-align: center;
    }

    .title {
        background: #0e90d2;
    }

    .title_top {
        background: #0e90d2;
    }

    .title_bottom:hover {
        background-color: #0e90d2;
    }
    .out{
        text-align: center;
    }
    span{
        color: red;
    }
    span:hover{
        color: #00B83F;
    }
</style>
<div class="container">
    <div class="row">
        <h3>员工信息登记表</h3>
        <div class="clo-md-8 out">
            <table class="table table-hover text-center table-bordered">
                <tr class="title">
                    <td class="title_bottom title_top">ID</td>
                    <td class="title_bottom title_top">姓名</td>
                    <td class="title_bottom title_top">性别</td>
                    <td class="title_bottom title_top">年龄</td>
                    <td class="title_bottom title_top">工资</td>
                </tr>

                {// foreach标签 }
                {//foreach $staffs as $staff}
                <!--<tr>-->
                    <!--<td class="title_bottom">{//$staff['staff_id']}</td>-->
                    <!--<td class="title_bottom">{//$staff['name']}</td>-->
                    <!--<td class="title_bottom">{//$staff['sex']}</td>-->
                    <!--<td class="title_bottom">{//$staff['age']}</td>-->
                    <!--<td class="title_bottom">{//$staff.salary}</td>-->
                <!--</tr>-->
                {///foreach}
                {//volist标签用法  offset="5" length="5" 限定从哪个偏移量到一定长度}
                {volist name='staffs' id='staff'  mod="2"      //offset="5" //length="5"  empty="数据表为null" }
                <tr>
                    {eq name="mod" value="1"//这个是用来判断输出基数还是偶数的}
                        <td class="title_bottom">{$staff['staff_id']}</td>
                        <td class="title_bottom">{$staff['name']}</td>
                        <td class="title_bottom">{$staff['sex']}</td>
                        <td class="title_bottom">{$staff['age']}</td>
                        <td class="title_bottom">{$staff.salary}</td>
                    {/eq}
                </tr>
                {/volist}
            </table>

        </div>
    </div>
</div>

运行实例 »

点击 "运行实例" 按钮查看在线实例

实例

{load href="/static/bootstrap/css/bootstrap.css"}
{load href="/static/jquery/jquery.js"}
{load href="/static/bootstrap/js/bootstrap.min.js"}
<style>
    h3 {
        text-align: center;
    }

    .title {
        background: #0e90d2;
    }

    .title_top {
        background: #0e90d2;
    }

    .title_bottom:hover {
        background-color: #0e90d2;
    }
    .out{
        text-align: center;
    }
    span{
        color: red;
    }
    span:hover{
        color: #00B83F;
    }
    .bottom_page{
        height: 60px;
        text-align: center;
        margin: 0 auto;
        width: 350px;
    }
    .page{
        float: left;

    }
    span{
        float: left;
        line-height: 70px;
    }
</style>
<div class="container">
    <div class="row">
        <h3>员工信息登记表</h3>
        <div class="clo-md-8 out">
            <table class="table table-hover text-center table-bordered">
                <tr class="title">
                    <td class="title_bottom title_top">ID</td>
                    <td class="title_bottom title_top">姓名</td>
                    <td class="title_bottom title_top">性别</td>
                    <td class="title_bottom title_top">年龄</td>
                    <td class="title_bottom title_top">工资</td>
                </tr>

                {// foreach标签 }
                {//foreach $staffs as $staff}
                <!--<tr>-->
                <!--<td class="title_bottom">{//$staff['staff_id']}</td>-->
                <!--<td class="title_bottom">{//$staff['name']}</td>-->
                <!--<td class="title_bottom">{//$staff['sex']}</td>-->
                <!--<td class="title_bottom">{//$staff['age']}</td>-->
                <!--<td class="title_bottom">{//$staff.salary}</td>-->
                <!--</tr>-->
                {///foreach}
                {//volist标签用法  offset="5" length="5" 限定从哪个偏移量到一定长度}
                {volist name='paginate' id='staff'}
                <tr>
                    <td class="title_bottom">{$staff['staff_id']}</td>
                    <td class="title_bottom">{$staff['name']}</td>
                    <td class="title_bottom">{$staff['sex']}</td>
                    <td class="title_bottom">{$staff['age']}</td>
                    <td class="title_bottom">{$staff.salary}</td>
                </tr>
                {/volist}
            </table>
            <div class="bottom_page">
                <div class="page">{$page|raw}</div>
                <span>总页数{$count}</span>
            </div>

        </div>
    </div>
</div>

运行实例 »

点击 "运行实例" 按钮查看在线实例


批改状态:未批改

老师批语:
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学