Post code:
Copy the Code code as follows:
/**
* Paging function
*
* Total @param int $count entries
* @param int $perlogs show the number of bars per page
* @param int $page current page number
* @param the address of the string $url page number
*/
function pagination ($count, $perlogs, $page, $url, $anchor = ') {
$pnums = @ceil ($count/$perlogs);
$re = ";
$urlHome = Preg_replace ("|[ \?&/][^\./\?&=]*page[=/\-]| "," ", $url);
for ($i = $page-5; $i <= $page +5 && $i <= $pnums; $i + +) {
if ($i > 0) {
if ($i = = $page) {
$re. = " $i ";
} elseif ($i = = 1) {
$re. = "$i";
} else {
$re. = "$i";
}
}
}
if ($page > 6) $re = "«... $re ";
if ($page + 5 < $pnums) $re. = "... »";
if ($pnums <= 1) $re = ';
return $re;
}
The above describes the PHP dynamic paging function, PHP development page must be, including the content of the contents, I hope that the PHP tutorial interested in a friend helpful.