tihinkphp with the page class style, sometimes can not meet the requirements of the project, here is the main introduction, page-style customization and beautification, make it more concise, beautiful THINKPHP5 controller wording
Function index ($keyword = ", $page = 1) { $map = []; if ($keyword) { $map [' code '] = [' like ', '%{$keyword}% ']; } $list =db (' package ')->where ($map)->paginate (, False, [' page ' = + $page]); return $this->fetch (' Index ', [' list ' = $list, ' keyword ' + $keyword]); }
Template notation
/* Loop OUTPUT Data * /{foreach $list as $vo} ID {$vo. id} {/foreach}/* page notation * /{$list->render ()}
Pagination Style
<style>/* paging */.pagination {}.pagination li {display:inline-block;margin-right: -1px;padding:5px;border:1px Solid #e2e2e2; min-width:20px;text-align:center;}. Pagination li.active {background: #009688; color: #fff; border:1px solid #009688;}. Pagination Li a {display:block;text-align:center;} </style>