//after reading the cache, assign a value to the array, which is handled by the Array_slice function, such as:$blog= S (' Blogname ');//Assign Value$count=Count($blog);//statistics of number of bars$page=NewPage ($count, 12);//instantiate the Page class$thisBlog =Array_slice($blog,$page->firstrow,$page->listrows);//Assign to Template$thispage =$page-Show ();$thisDisplay ();
After the revision
/** * Relevant expected position recommended CV data pagination * * Combined with the Get_jianli_hy_tuijian () method under the same controller * * $list obtained data * * $num a page showing a few * * $p need Data on page Number * * * method Array_slice (); Can Baidu Php Array_slice method you will understand * **/ Public functionGet_tj_jianli_page ($list,$num,$p){ $_get[' P '] =$p; $count=Count($list);//the total number of records that the query meets the requirements $Page=New\think\page ($count,$num);//instantiate the total number of incoming records in a paging class and the number of records displayed per page $show=$Page->show ();//pagination Display Output $data[' list '] =Array_slice($list,$Page->firstrow,$Page->listrows);//Assign to Template $data[' P '] =$count/$num>$p?$p+1: ";//Just to make the next page return $data; }
thinkphp framework, after the data is cached dynamically, or the data has been read out, what to do about paging