ThinkPhp5 uses bootstrap style pagination

1. View the paging configuration

Last in the application/config.php file.

//Pagination configuration
 'paginate'                => [
 'type'       => 'bootstrap' ,
 'var_page'   => 'page' ,
 'list_rows' => 15 ,
 ],            
2. Download: https://v3.bootcss.com/getting-started/#download


3. Create a new lib folder in the public/static directory to store third-party style files, and extract the downloaded files to the lib directory


4. Reference the css and js files in the template file of the desired paging in the project

 
 
{load href="__STATIC__/lib/bootstrap-3/css/bootstrap.css" /}
 
 
 
 
{load href="__STATIC__/lib/bootstrap-3/js/bootstrap.js" /}
5. Use paginate() in the controller file to query, for example
 
 
// 查询状态为1的用户数据 并且每页显示10条数据
$list = User::where('status',1)->paginate(10);
6. Add the following code after {volist}......{/volist} in the view file
 
 
<div align="center">
   {$list->render()}
</div>
7. The effect is as follows




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325852746&siteId=291194637