求一个可移植性强一点的分页程序!!!!!!!!!!!!
Jun 21, 2016 am 09:08 AM程序|分页
function multi($num, $perpage, $curr_page, $mpurl) {
$multipage = '';
if($num > $perpage) {
$page = 10;
$offset = 2;
$pages = ceil($num / $perpage);
$from = $curr_page - $offset;
$to = $curr_page + $page - $offset - 1;
if($page > $pages) {
$from = 1;
$to = $pages;
} else {
if($from $to = $curr_page + 1 - $from;
$from = 1;
if(($to - $from) $to = $page;
}
} elseif($to > $pages) {
$from = $curr_page - $pages + $to;
$to = $pages;
if(($to - $from) $from = $pages - $page + 1;
}
}
}
$multipage .= " ";
for($i = $from; $i if($i != $curr_page) {
$multipage .= "[$i] ";
} else {
$multipage .= '['.$i.'] ';
}
}
$multipage .= $pages > $page ? " ... [$pages] >>" : " >>";
}
return $multipage;
}

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What are the differences between Huawei GT3 Pro and GT4?

Fix: Snipping tool not working in Windows 11

How to Fix Can't Connect to App Store Error on iPhone

How to implement data paging and display optimization in Vue projects

You can't specify target table 'table_name' for update in FROM clause - How to solve MySQL error: Unable to update target table in FROM clause

How to optimize iPad battery life with iPadOS 17.4
