php分页,该如何处理

WBOY
Release: 2016-06-13 10:11:55
Original
869 people have browsed it

php分页


$pageCount = 9;//总页数
$pageNow = 3;//用户输入的页数
$i = 3;//显示的页数
$j = $pageCount/$i; //可以滚动的次数
$arr=array() ;

//控制滚动的次数
for($k=0;$k
//控制翻页
if($pageNow==3*$k) {

for($e=($k*3)+1;$e
$arr[] = $e;
//echo $e;
}
//echo "";
}else {
//输出当前显示页数
for($a=0;$a $arr[$a];

}

}
}

?>
帮忙给看下,那里出问题了。





------解决方案--------------------

PHP code
$pageCount = 9;//总页数$pageNum = 3;//显示的页码数$pageNow = $_GET['page'] ? $_GET['page'] : 1;//用户输入的页数if( $pageNow == $pageCount ) $pageNow = 1; //循环滚动,加上这句$pageStart = floor($pageNow / $pageNum) * $pageNum + 1; //显示的起始页码$pageEnd = $pageStart + $pageNum;//显示的终止页码+1for($i=$pageStart; $i$i] ";}<div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template