Copy CodeThe code is as follows:
/*
* Paging function
* $num Total number of bars, $perpage how many pages, $curpage the current page, $mpurl url, $page = 10 shows several pagination
*
*/
function multi ($num, $perpage, $curpage, $mpurl, $page = 10) {
$multipage = ";
$realpages = 1;
if ($num > $perpage) {
$offset = 4;
$realpages = @ceil ($num/$perpage);
if ($page > $realpages) {
$form = 1;
$to = $realpages;
}else {
$form = $curpage-$offset;
$to = $form + $page-1;
if ($form < 1) {
$form = 1;
$to = $curpage + 1-$form;
if ($to-$form < $page) {
$to = $page;
}
}
}
$multipage = ($curpage > 1? ' Up ': ');
for ($i = $form; $i <= $to; $i + +) {
$multipage. = $i = = $curpage? '
'. $i. '' :
". $i.";
}
$multipage. = $curpage < $realpages? ' Next ': ';
$multipage = $multipage? ". $multipage. ': ';
}
return $multipage;
}
http://www.bkjia.com/PHPjc/320168.html www.bkjia.com true http://www.bkjia.com/PHPjc/320168.html techarticle Copy the code as follows:/* Page function * $num total number of bars, $perpage how many pages, $curpage the current page, $mpurl url, $page = 10 display several pagination * */function multi ($num, $per ...