转载自:https://my.oschina.net/u/3911977/blog/2872588 use think\Paginator\driver\Bootstrap; $all_idents = get_addon_list();//这里是需要分页的数据 $curPage = input('get.page') ? input('get.page') : 1;//接收前段分页传值 $listRow = 1;//每页2行记录 $showdata = array_slice($all_idents, ($curPage - 1)*$listRow, $listRow,true);// 数组中根据条件取出一段值,并返回 $p = Bootstrap::make($showdata, $listRow, $curPage, count($all_idents), false, [ 'var_page' => 'page', 'path' => url('/admin/addons/index'),//这里根据需要修改url 'query' => [], 'fragment' => '', ]); $p->appends($_GET); $this->assign('list', $p); $this->assign('listpage', $p->render());