先上效果圖,突然發(fā)現(xiàn)和b站上一樣
indexcontroller.class.php代碼如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
public function index(){ $m =m( 'info' ); $count = $m ->where( $where )-> count (); $pagecount = 10; //每頁顯示數(shù)量 $page = new \think\page( $count , $pagecount ); $page ->parameter = $row ; //此處的row是數(shù)組,為了傳遞查詢條件 $page ->setconfig( 'header' , '條留言' ); $page ->setconfig( 'first' , '首頁' ); $page ->setconfig( 'prev' , '上一頁' ); $page ->setconfig( 'next' , '下一頁' ); $page ->setconfig( 'last' , '尾頁' ); $page ->setconfig( 'theme' , '%first% %up_page% %link_page% %down_page% %end%<div id="pagetips">第 ' .i( 'p' ,1). ' 頁/共 %total_page% 頁 ( ' . $pagecount . ' 條/頁 共 %total_row% 條信息)</div>' ); $show = $page ->show(); $list = $m ->where( $where )->order( 'id desc' )->limit( $page ->firstrow. ',' . $page ->listrows)->select(); $this ->assign( 'infolist' , $list ); $this ->assign( 'show' , $show ); $this ->display(); } |
index.html代碼如下
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
|
<table class = "table table-hover table-striped" id= "table" > <tr class = "danger" > <th>類別</th> <th>信息標題</th> <th>物品類型</th> <th>遺失/拾物時間</th> <th>遺失/拾物地點</th> <th >發(fā)布時間</th> </tr> < foreach name= "infolist" item= 'vo' > <tr > <td>{ $vo .info_type}</td> <td>{ $vo .info_title}</td> <td>{ $vo .thing_type}</td> <td>{ $vo .info_time}</td> <td>{ $vo .info_place}</td> <td>{ $vo .create_time}</td> </tr> </ foreach > </table> <div class = "page" > <ul> { $show } </ul> </div> |
css代碼如下
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
|
/* start 分頁樣式 */ .page{ overflow:hidden; margin:50px 0 50px 100px;; } .page ul a,.page ul span{ float:left; display:inline-block; padding: 0 17px; height:40px; width:auto; border:1px solid #dddddd; border-radius: 4px; background:#fff; text-align:center; line-height:40px; margin-right:10px; font-family: "microsoft yahei" simhei sans-serif; color:#7d7d7d; } .page ul a:hover{ background:#337ab7; color:#fff; text-decoration:none; } .page ul span.current{ background: #337ab7; color:#fff; } .page ul a:first,.page ul a:last{ float:left; display:inline-block; width:40px; height:40px; border-radius:50%; background:rgb(215, 215, 217); text-align:center; line-height:40px; margin-right:10px; font-family: "microsoft yahei" simhei sans-serif; } #pagetips { float:right; } /* end 分頁樣式 */ |
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持服務(wù)器之家。