简洁好用的php通用分页
- php >= 7.3
- Composer
composer require zyan/page -vvv
use Zyan\Page\Page;
$config = [
'total_rows' => 1000, //总条数
'url_rule' => '/list/?.html', //url规则 ? 代替分页数
'now_page' => 50, //当前页
'list_rows' => 10, //一页显示多少条
];
$page = Page($config);
echo $page->show();
<div class="zyan-page">
<a href="/list/1.html">第一页</a>
<a href="/list/49.html">上一页</a>
<a href="/list/47.html">47</a>
<a href="/list/48.html">48</a>
<a href="/list/49.html">49</a>
<a class='active'>50</a>
<a href="/list/51.html">51</a>
<a href="/list/52.html">52</a>
<a href="/list/53.html">53</a>
<a href="/list/51.html">下一页</a>
<a href="/list/100.html">最后一页</a>
</div>
$config = [
'first_page_name' => '<<', //第一页
'prev_page_name' => '<', //上一页
'next_page_name' => '>', //下一页
'last_page_name' => '>>', //最后一页
//...
];
$page = Page($config);
- fork 当前库到你的名下
- 在你的本地修改完成审阅过后提交到你的仓库
- 提交 PR 并描述你的修改,等待合并