返回输出用户信息列......登陆

输出用户信息列表,并显示分页

JasonKim2019-04-23 23:51:081630

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

<?php

//渲染用户信息  控制器层

public function info()

{

    // 配置

    $config = [

        'type'=>'bootstrap',

        'var_page'=>'page',

    ];

 

    // 每页显示条数

    $num = 6;

 

    // 是否使用简单分页

    $simple = false;

 

    // 获取数据

    $paginate = Users::paginate($num,$simple,$config);

 

    // 获取分页代码

    $page $paginate->render();

 

    // 赋值数据

    $this->assign('datas',$paginate);

    // 赋值分页

    $this->assign('page',$page);

    // 渲染模板

    return $this->fetch();

}

?>

 

 

// 模板层

<!doctype html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport"

 content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">

    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <title>用户信息列表</title>

    <link rel="stylesheet" href="/static/bootstrap/css/bootstrap.css">

</head>

<body>

 

    <div class="panel panel-default">

        <div class="panel-heading">用户信息列表</div>

        <div class="panel-body">

            <p>信息详细</p>

        </div>

 

        <!-- Table -->

 <table class="table">

            <thead>

                <tr>

                    <th>姓名</th>

                    <th>电话</th>

                    <th>国家</th>

                    <th>生日</th>

                    <th>体重</th>

                    <th>身高</th>

                    <th>添加时间</th>

                </tr>

            </thead>

 

            <tbody>

 

                {volist name="datas" id="item"}

 <tr>

                    <td>{$item.name}</td>

                    <td>{$item.phone}</td>

                    <td>{$item.country}</td>

                    <td>{$item.birthday}</td>

                    <td>{$item.weight}</td>

                    <td>{$item.height}</td>

                    <td>{$item.add_time|date='Y-m-d H:i:s'}</td>

                </tr>

                {/volist}

 </tbody>

        </table>

    </div>

 

    <div class="page" style="text-align: center">

        {$page|raw}

 </div>

 

</body>

<script src="/static/bootstrap/js/boostrap.js"></script>

</html>

// 效果图

1556034511(1).jpg

最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送