最新消息: 新版网站上线了!!!

thinkphp对数组进行分页输出

mport('ORG.Util.Page');// 导入分页类
$count=count($newarray_1);//得到数组元素个数
$Page= new Page($count,25);// 实例化分页类 传入总记录数和每页显示的记录数
$newarray_1 = array_slice($newarray_1,$Page->firstRow,$Page->listRows);
$show= $Page->show();// 分页显示输出
//print_r($newarray_1);
$this->assign("rs",$newarray_1);
$this->assign('page',$show);// 赋值分页输出
$this->display();

转载请注明:谷谷点程序 » thinkphp对数组进行分页输出