Fork me on GitHub
代码改变世界

thinkphp 分页函数

2013-04-12 15:25  freefei  阅读(331)  评论(0编辑  收藏  举报
如果 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://github.com/ranmufei

守望者舆情监控

守望者舆情监控系统