Blogger Information
Blog 53
fans 4
comment 3
visits 41704
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php0530TP框架分页显示数据
有点凉了
Original
936 people have browsed it


实例

<?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>

运行实例 »

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


Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post