PHP区间分页_PHP教程
程序员文章站
2024-01-21 11:12:22
...
Php代码
function outpage($page_total,$page_no,$page_limit=5) {
$page_list = '';
$max = $page_no >= $page_limit ? $page_no + $page_limit : 10;
if ($max > $ps) $max = $ps;
$min = $page_no - $page_limit;
if ($min if ($page_no > 1) $page_list .= '首页';
for ($i=$min; $i $page_list .= $page_no >= $page_total ? '' : '尾页';
}
调用:
Php代码
echo outpage($page_total,$_GET['page'],6);
function outpage($page_total,$page_no,$page_limit=5) {
$page_list = '';
$max = $page_no >= $page_limit ? $page_no + $page_limit : 10;
if ($max > $ps) $max = $ps;
$min = $page_no - $page_limit;
if ($min if ($page_no > 1) $page_list .= '首页';
for ($i=$min; $i $page_list .= $page_no >= $page_total ? '' : '尾页';
}
调用:
Php代码
echo outpage($page_total,$_GET['page'],6);
作者“cevin@iteye”