protected function do_page1($table){
$m=M($table);
import('ORG.UTIL.Page');
$where['id']=$_REQUEST['id'];//在表单中传入数据的主键ID,否则取0
$arr=$m->where($where)->find();
$cut='<hr style="page-break-after:always;" class="ke-pagebreak" />';
$arr['content']=array_filter(explode($cut,$arr['content']));
$count=count($arr['content']);
//dump($arr);
//dump($count);
$page=new Page($count,1);
$page->setConfig('theme', "%totalRow% %header% %nowPage%/%totalPage% 页 %upPage% %first% %prePage% %linkPage% %downPage%%nextPage% %end%"
);
$show=$page->show();
$p = I('get.p',1,'intval');
$firstRow = ($p === 1) ? 0 : ($p - 1) * 1;
$arr['content']=array_slice($arr['content'],$firstRow,1);
$this->assign('arr',$arr);
//dump ($arr);
$this->assign('page',$show);// 赋值分页输
$this->display();
}
thinkphp 文章分页
最新推荐文章于 2019-06-28 14:06:04 发布