《PHP應(yīng)用:ThinkPHP 3.2 數(shù)據(jù)分頁(yè)代碼分享》要點(diǎn):
本文介紹了PHP應(yīng)用:ThinkPHP 3.2 數(shù)據(jù)分頁(yè)代碼分享,希望對(duì)您有用。如果有疑問(wèn),可以聯(lián)系我們。
PHP實(shí)例TP3.2框架手冊(cè),有一個(gè)數(shù)據(jù)分頁(yè),不過(guò)每次都要寫(xiě)太多的代碼,還有中文設(shè)置等有些麻煩,做為程序開(kāi)發(fā)者,有必要整理下:
PHP實(shí)例O、先看效果圖
PHP實(shí)例
PHP實(shí)例一、分頁(yè)方法
PHP實(shí)例??? $p->parameter=I('get.');
PHP實(shí)例??? $m->limit($p->firstRow,$p->listRows);
PHP實(shí)例??? return $p;
}
PHP實(shí)例getpage方法可以放在TP框架的 Application/Common/Common/function.php,這個(gè)文檔可以專(zhuān)門(mén)放置一些通用的方法,在哪里都可以調(diào)用(如:Controller文件,View文件等).
PHP實(shí)例二、調(diào)用分頁(yè)方法
PHP實(shí)例<div class="pagination">
{$page}
</div>
PHP實(shí)例三、最后就是分頁(yè)的樣式了,這個(gè)有些亂,因后臺(tái)框架網(wǎng)上下載的,樣式還沒(méi)來(lái)的及整理,這個(gè)樣式也可以自己實(shí)現(xiàn),簡(jiǎn)單的.
PHP實(shí)例.pagination ul li.rows {
??? line-height: 30px;
??? padding-left: 5px;
}
.pagination ul li.rows b{color: #f00}
PHP實(shí)例.pagination ul li a, .pagination ul li span {
??? float: left;
??? padding: 4px 12px;
??? line-height: 20px;
??? text-decoration: none;
??? background-color: #fff;
??? background: url('../images/bottom_bg.png') 0px 0px;
??? border: 1px solid #d3dbde;
??? /*border-left-width: 0;*/
??? margin-left: 2px;
??? color: #08c;
}
.pagination ul li a:hover{
??? color: red;
??? background: #0088cc;
}
.pagination ul li.first-child a, .pagination ul li.first-child span {
??? border-left-width: 1px;
??? -webkit-border-bottom-left-radius: 3px;
??? border-bottom-left-radius: 3px;
??? -webkit-border-top-left-radius: 3px;
??? border-top-left-radius: 3px;
??? -moz-border-radius-bottomleft: 3px;
??? -moz-border-radius-topleft: 3px;
}
.pagination ul .disabled span, .pagination ul .disabled a, .pagination ul .disabled a:hover {
color: #999;
cursor: default;
background-color: transparent;
}
.pagination ul .active a, .pagination ul .active span {
color: #999;
cursor: default;
}
.pagination ul li a:hover, .pagination ul .active a, .pagination ul .active span {
background-color: #f0c040;
}
.pagination ul li.last-child a, .pagination ul li.last-child span {
??? -webkit-border-top-right-radius: 3px;
??? border-top-right-radius: 3px;
??? -webkit-border-bottom-right-radius: 3px;
??? border-bottom-right-radius: 3px;
??? -moz-border-radius-topright: 3px;
??? -moz-border-radius-bottomright: 3px;
}
PHP實(shí)例.pagination ul li.current a{color: #f00 ;font-weight: bold; background: #ddd}
維易PHP培訓(xùn)學(xué)院每天發(fā)布《PHP應(yīng)用:ThinkPHP 3.2 數(shù)據(jù)分頁(yè)代碼分享》等實(shí)戰(zhàn)技能,PHP、MYSQL、LINUX、APP、JS,CSS全面培養(yǎng)人才。
轉(zhuǎn)載請(qǐng)注明本頁(yè)網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/14552.html