thinkphp实现分页下个多少页
2个回答
展开全部
// 用来获取当前用户的买入订单
public function TradingList($p = null) {
$p = intval($p) ? intval($p) : 1;
$pageSize = 15;
$offset = ($p - 1) * $pageSize;
$db = M('rebate_trading');
$TradingList = $db->where(array('userid' => XAAKE))->order('time')->limit($offset, $pageSize)->select();
$count = count($db->where(array('userid' => XAAKE))->select());
$page = new \Think\Page($count, $pageSize);
$page = $page->show();
$this->assign('page', $page);
$this->assign('TradingList', $TradingList);
$this->pagetitle = '已买入订单';
$this->display();
}
你应该可以看得懂
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询