Heim >Backend-Entwicklung >PHP-Tutorial >php 分页类(第一版本),_PHP教程
此版本为第一版 , 以get 方式传递页码数及其他参数 .
使用方法 :1
getLimit();
int(90) ["end"]=> string(3) "100" }
pageInfo($arr); 获取页码信息如下 : 首页,上一页 ,下一页,尾页等按实际情况显示
<span </span><span <</span><span p</span><span ></span>总记录:<span <</span><span span </span><span style</span><span ="color:red"</span><span ></span>100<span </</span><span span</span><span ></span>条 页码7/10<span </</span><span p</span><span ><br /> <</span><span a </span><span href</span><span ="/index.php/index/pro?heng=1&page=1"</span><span ></span>首页<span </</span><span a</span><span ><br /> <</span><span a </span><span href</span><span ="/index.php/index/pro?heng=1&page=6"</span><span ></span>上一页<span </</span><span a</span><span ><br /> <</span><span a </span><span href</span><span ="/index.php/index/pro?heng=1&page=5"</span><span ></span>5<span </</span><span a</span><span ><br /> <</span><span a </span><span href</span><span ="/index.php/index/pro?heng=1&page=6"</span><span ></span>6<span </</span><span a</span><span ><br /> <</span><span span</span><span ></span>7<span </</span><span span</span><span ><br /> <</span><span a </span><span href</span><span ="/index.php/index/pro?heng=1&page=8"</span><span ></span>8<span </</span><span a</span><span ><br /> <</span><span a </span><span href</span><span ="/index.php/index/pro?heng=1&page=9"</span><span ></span>9<span </</span><span a</span><span ><br /> <</span><span a </span><span href</span><span ="/index.php/index/pro?heng=1&page=8"</span><span ></span>下一页<span </</span><span a</span><span ><br /> <</span><span a </span><span href</span><span ="/index.php/index/pro?heng=1&page=10"</span><span ></span>尾页<span </</span><span a</span><span ></span>
pageInfo() 默认参数及顺序为 'count','first','count','pre','listing','next','last' . 可自行设置:
<span 1</span> <span $arr</span> = <span array</span><span ( </span><span 2</span> 'count','first','pre','listing','next','last' <span 3</span> <span ); </span><span 4</span> <span $pageInfo</span> = <span $page</span>->pageInfo(<span $arr</span>);
4 可以使用 setPageListNum() 方法设置页码显示个数
<span $page</span>->setPageListNum(<span $num</span>);