php超强分页类源码

上传人:第*** 文档编号:37237356 上传时间:2018-04-09 格式:DOC 页数:6 大小:38KB
返回 下载 相关 举报
php超强分页类源码_第1页
第1页 / 共6页
php超强分页类源码_第2页
第2页 / 共6页
php超强分页类源码_第3页
第3页 / 共6页
php超强分页类源码_第4页
第4页 / 共6页
php超强分页类源码_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《php超强分页类源码》由会员分享,可在线阅读,更多相关《php超强分页类源码(6页珍藏版)》请在金锄头文库上搜索。

1、更多关于 PHP 的代码访问 http:/_currentPage = max(int)$_GETpageId, 1); /当前的页序号$this-_perPage = $_perPage; /每一页记录数$this-_totalItems = $_totalItems; /总记录数$this-_totalPages = ceil($this-_totalItems / $this-_perPage); /总页数$this-_linkData = $_linkData; /传递的变量$this-_listStart = ($this-_currentPage - 1) * $this-_per

2、Page + 1; /当前头条记录 ID$this-_listEnd = ($this-_currentPage != $this-_totalPages) ? $this-_currentPage * $this-_perPage : $this-_totalItems; /当前最后条记录 ID$this-_startId = $this-_listStart -1; /从数据库读出的启始 id function startId() / 从数据库读出的启始 id return $this-_startId; function totalItems() / 总记录数 return $this-

3、_totalItems; function totalPages() / 总页数 return $this-_totalPages; function listStart() / 当前头条记录 ID return $this-_listStart; function listEnd() / 当前最后条记录 ID return $this-_listEnd; function currentPage() / 当前页 return $this-_currentPage; function pageStart() / 第一页 return $this-_pageStart = “_linkData)

4、 . “ function pageEnd() / 最后页 return $this-_pageEnd = “_linkData) . “ function upPage() / 上一页 if ($this-_currentPage 1 and $this-_currentPage _totalPages) $up = $this-_currentPage-1; return $this-_upPage = “_linkData) . “ function downPage() / 下一页 $down = $this-_currentPage + 1; if ($this-_currentPa

5、ge _totalPages) return $this-_downPage = “_linkData) . “ function listPage() / 循环显示当前分页列表 if ($this-_currentPage _currentPage != “) $start = 1; if ($this-_totalPages _totalPages; else $end = 10; elseif ($this-_currentPage + 5) $this-_totalPages) $start = $this-_currentPage - 5; $end = $this-_totalPa

6、ges; else $start = $this-_currentPage - 4; $end = $this-_currentPage + 5; for($i = $start; $i _listPage .= “_linkData) . “ return $this-_listPage; function jumpPage() / 跳转 $this-_jumpPage = “跳转 _linkData) . “; /页面跳转for($i = 1; $i _totalPages; $i+) if ($i = $this-_currentPage) $selected = “selected“;

7、 $this-_jumpPage .= “$i“; unset($selected); return $this-_jumpPage .= “ 页“; / /范例$totalItems = 1100; /总记录$page = new Pager($totalItems, 20, “?a=b for($i = $page-startId(); $i startId() + 20; $i+) $data = array($i, $i + 1); echo “当前开始 ID:“ . $listStart = $page-listStart(); echo “; echo “当前结束 ID:“ . $

8、listEnd = $page-listEnd(); echo “; echo “第一页:“ . $pageStart = $page-pageStart(); echo “; echo “最后页:“ . $pageEnd = $page-pageEnd(); echo “; echo “上一页:“ . $upPage = $page-upPage(); echo “; echo “下一页:“ . $downPage = $page-downPage(); echo “; echo “列表显示:“ . $listPage = $page-listPage(); echo “; echo “跳转页:“ . $jumpPage = $page-jumpPage(); echo “; / print_r($data);? 更多代码访问 http:/

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号