PHP 分页类代码(简单好用型)

前端之家收集整理的这篇文章主要介绍了PHP 分页类代码(简单好用型)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="51220" class="copybut" id="copybut51220" onclick="doCopy('code51220')"> 代码如下:

<div class="codebody" id="code51220">
<?PHP
// pager类
$page = $_GET;
function pager($rows,$page_size){
global $page,$select_from,$select_limit,$pagenav;
$page_count = ceil($rows/$page_size);
if($page <= 1 || $page == '') $page = 1;
if($page >= $page_count) $page = $page_count;
$select_limit = $page_size;
$select_from = ($page - 1) $page_size.',';
$pre_page = ($page == 1)? 1 : $page - 1;
$next_page= ($page == $page_count)? $page_count : $page + 1 ;
$pagenav .= "第 $page/$page_count 页共 $rows 条记录";
$pagenav .= "首页";
$pagenav .= "前一页";
$pagenav .= "后一页";
$pagenav .= "末页";
$pagenav.=" 跳到