Number of page numbers for circular paging

巴扎黑
Release: 2016-11-22 16:20:35
Original
1216 people have browsed it

$page = 1;

$total = 20;

 

$prevs = $page - 4;

if($prevs <= 0) {

$prevs = 1;

}

$next = $page + 4;

if($next > $total) {

$next = $total;

}

for($i = $prevs; $i <= $page - 1; $i++) {

echo $i."rn";

}

echo '['.$page.']'."rn";

for($i = $page + 1; $i <= $next; $i++) {

echo $i."rn";

}


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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!