php部分
//1、查詢數(shù)據(jù)庫總條數(shù)
$count = $this->custom->count();
//2、設置每頁顯示條數(shù)
$rev = '10';
//3、求總頁數(shù)
$sums = ceil($count/$rev);
//4、求單前頁
$page = Input::get('page');
if(empty($page)){
? ? $page = "1";
}
//5、設置上一頁、下一頁
$next = ($page+1)<$sums?$page+1:$sums;
$prev = ($page-1)>0?$page-1:1;
//6、求偏移量
$offset = ($page-1)*$rev;
//7、sql查詢數(shù)據(jù)庫
$data = $this->custom->custom($offset,$rev);
$data = json_decode($data);
//8、數(shù)字分頁
$pp = array();
for($i=1;$i<=$sums;$i++){
? ? $pp[$i]=$i;
}
return view('admin.expire',compact('data','page','prev','next','sums'));

HTML部分


::一定要注意 id=“box”? 寫到最外面那層div