dd

基于tp的数组分页

jerry thinkphp 2015年11月18日 收藏
或许有的时候数据并不是全都是从库里面查出来的吧!那天遇到一个就是先查出库里面的数据,然后在通过条件判断,得到一个数组!这个时候用到分页了,怎么整?看看
function array_page($array,$rows){

            import("ORG.Util.Page"); //导入分页类
            $count=count($array);
            $Page=new Page($count,$rows);
            $list=array_slice($array,$Page->firstRow,$Page->listRows);
            return $list;

}
dd