thinkphp分頁

來源:互聯網
上載者:User

標籤:style   io   ar   sp   div   on   cti   html   ad   

1.我剛學的時候都不知道thinkphp的分頁是這麼回事,不過現在好多啦!

1.thinkphp的分頁首先要導包:

這是action :

class TestAction extends Action{
public function index(){
import("@.ORG.Page"); //匯入分頁的包。
$count = M(‘orders140619‘,‘ebay_‘,‘DB_ORDER‘)->count(); //得到總數。
$page = new Page($count,10);

$page->rollPage = 7; //分頁顯示的頁數 首頁 « 上一頁 1234567 下一頁 » 末頁 1/16 頁
$page->setConfig(‘theme‘,‘%totalRow% %header% %first% %upPage% %linkPage% %downPage% %end% %nowPage%/%totalPage% 頁‘);
$show = $page->show(); //顯示
$limit = $page->firstRow. ‘,‘ .$page->listRows; //設定顯示的行數。

$list = M(‘orders140619‘,‘ebay_‘,‘DB_ORDER‘)->limit($limit)->field(‘id,order_number_id,account_id‘)->select();//查詢所需要的值
$this->assign(‘list‘,$list);
$this->assign(‘page‘,$show);// 賦值分頁輸出
$this->display();

}
}


頁面的顯示:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>分頁頁面</title>
</head>
<body>
<table border="1px" align="center">
<tr><td>訂單號</td><td>隨筆</td></tr>
<volist name="list" id="vo">
<tr><td>{$vo.id}</td>
<td>{$vo.order_number_id}</td>
<td>{$vo.account_id}</td>
</tr>
</volist>
</table>
<div style="text-align:center">{$page}</div><!--這就是顯示分頁的功能-->
</body>
</html>

thinkphp分頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.