Home  >  Article  >  Backend Development  >  PHP classic paging navigation function

PHP classic paging navigation function

WBOY
WBOYOriginal
2016-08-08 09:33:351085browse

php经典分页导航函数源码: 复制PHP内容到剪贴板
PHP代码:
#*********************************************************
#文件名称: function.php
#功能描述: 新闻添加修改处理模块
#程序制作:留印(adleyliu)
#联系QQ  :14339095
#联系邮箱:[email=adleyliu@163.com]adleyliu@163.com[/email]
#官方网站: [url=http://www.115000.com.cn]http://www.115000.com.cn[/url]
#copyright (c) 2007-2008 115000.com.cn all rights reserved.
#最后更新:     2007-11-20
#*********************************************************


#*********************************************************
#分页函数
#*********************************************************
function yl_list_page($pageurl,$rsnum,$pages,$pagecount,$pagesize){
#url
#总记录
#总页数
#当前页码
#每页显示数
   //$pageurl='?';
   $pcount = $pages;
   $page_info = '

';
   $page_info .= '
';
   if (($pcount > 1) && ($pcount == $pagecount) ){
       $page_info .= '上一页';
   }elseif (($pagecount != 1) && ($pcount != $pagecount)){
      $page_info .= '上一页';
   }
      $page_info .= '页首';
   if ($pagecount > 4){
     $page_info .= '[1]...';
   }
   if ($pcount > $pagecount+2){
       $endpage = $pagecount+2;
   }else{
     $endpage = $pcount;
   }
   for ($n = ($pagecount-2); $n <= $endpage; $n++){
if (!($n < 1)){
if ($n == intval($pagecount)){
$page_info .= ''.$n.'';
     }else{
        $page_info .= '['.$n.']';
     }
      }
   }
   if ($pagecount+2 < $pcount){
       $page_info .= '...['.$pcount.']';
   }
       $page_info .= '页尾';
   if (($pagecount == 1) && ($pcount != $pagecount) && ($pcount != 0)){
       $page_info .= '下一页';
   }else if (($pagecount != 1) && ($pcount != $pagecount)){
       $page_info .= '下一页';
   }
       $page_info .= '
';
   $page_info .= '
';
   $page_info .= '
共:'.$rsnum .'条/'.$pcount.'页 每页/'.$pagesize.'条
';
   $page_info .= '
';
   //echo '
';
   $page_info .= ' 转到';
   $page_info .= '';
   $page_info .= '页 ';
   //echo '
';
   $page_info .= '
';
   $page_info .= '
';
Return $page_info;
}

The above has introduced the PHP classic paging navigation function, including the content of PHP paging navigation. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn