< ul class="fn-clear">";
// Previous page
if ($offset>0) {
$result .= "
;a href="".$url.'offset='.($offset-$maxrow)."">Prev
🎜> $pages = $allPageNums; //Total number of pages
$page = $curPage; //Current page number
$page_len = 9;
$page_len = ($page_len%2)?$page_len :$pagelen+1;//Number of page numbers
$pageoffset = ($page_len-1)/2;//Offset to the left and right of page number
if($pages>$page_len){
//If the current page is less than or equal to the left offset
The page is greater than the left offset
//If the right offset of the current page number exceeds the maximum number of pages
if($page+$pageoffset>=$pages+1){
$init = $pages-$page_len+ 1;
$max_p = $pages; $max_p = $page+ $pageoffset;
} }
} }
} else {
for($i=$init; $i<=$max_p; $i++) {
if ( $i == $curPage ) {
$result .= "$i";
continue;
}
$result .= "
$i";
}
// Print next page
if ( $allnums > ($offset+$maxrow) ) { 🎜>
http://www.bkjia.com/PHPjc/824876.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/824876.html
TechArticle
There are many ways to paginate in PHP. Today we will use a small example to demonstrate this function. Copy the code The code is as follows: $result = "div class="page-num"ul class="fn-clear""; // Previous page...