Pagination to show max value and limit the rest

前端 未结 2 1890
轮回少年
轮回少年 2021-01-07 04:19

Right now my pagination would show up something like this

[1] [2] [3] [4] [5] [6] [7] [8] [9]

How would i make it show up like this

[1] [2] [3] [4] [

2条回答
  •  一向
    一向 (楼主)
    2021-01-07 05:00

    =1 && $page <= $pages) {
            $counter = 1;
            $link = "";
            for ($x=1; $x<=$pages;$x++) {
                if($counter < 5)
                    $link .= "".$x."";
    
                $counter++;
            }
            $link .= "...";
            $link .=  "".$pages."";
        }
        echo $link;
    ?>
    

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题