-2

如何将显示帖子摘录的主页拆分为不同的页面,每页仅显示 5 个摘录并具有显示旧帖子的链接?像这样:

4

1 回答 1

0

您需要查看分页 您的脚本将具有与此类似的工作流程

<?php
$totalpost = 100;
$currentpost = 0;
$pagelimit = 5;
$current_page = 0;
$current_page_count = 0;
$totalpages = $totalpost / $pagelimit;
while($currentpost < $totalpost){
    $current_page_count = 0;
    while($current_page_count < $pagelimit){
        echo " $currentpost ";
        $currentpost++;
        $current_page_count++;
    }

    echo " <br> page $current_page <br>";
    $current_page++;
}
?>
于 2013-01-07T01:56:19.460 回答