thinkphp 分页函数

如果 findPage 不能满足要求 试试这个 [php] /** According to the array paging * @param array $array * @param int $limit * @return array */ function arrayPage($array,$limit) { $count = count($array); if($count){ import('ORG.Util.Page');//引入分页类 $p = New Page($count,$limit); $data['list'] = array_slice($array, $p->firstRow, $p->listRows); $data['page'] = $p->show(); return $data; } } [/php] action 使用 [php] $pages = arrayPage($comp,10); //dump($pages); $this->assign('list',$pages); [/php]
原文地址:https://www.cnblogs.com/freefei/p/3234993.html