如何使用这行代码在PHP中实现动态分页?

时间:2021-11-21 14:30:41

I want to know how can I make this list inline from 1 to 1000 etc maybe with scroll will do, and base on my ouput the prev and 1 is not included, How can I fix this?

我想知道怎样才能使这个列表从1到1000等内联,也可以用滚动来做,并且根据我的输出,prev和1不包括在内,我该如何解决这个问题?

如何使用这行代码在PHP中实现动态分页?

Here's the code I use:

这是我使用的代码:

echo 
        '<div class="pagination">
            <ul>
                <li>Prev</li>';
        if(isset($_SESSION['paging'])){
            $pages=$_SESSION['paging'];
            echo 
                '<li>'.$pages.'</li>';
        }
        else{
            echo 
                '<li>'.$pages.'</li>';
            $_SESSION['paging']=$pages;
            $_SESSION['paging1']=$pages;
        }
?>
        <li>Next</li>
    </ul>
</div>

1 个解决方案

#1


3  

This is a wrong approach ... It doesn't make sense serving 1k of pagination links! This is a horrible user experience and unnecessary load to the DOM

这是一种错误的方法......服务1k的分页链接是没有意义的!这是一种糟糕的用户体验和对DOM的不必要负担

I would recommend you go like the approach I am listing below :

我建议你像我列出的方法一样:

Say your current active page is #11

说你当前的活动页面是#11

<|- Start <- Previous - 9 - 10 - 11 - 12 - 13  - Next -> Last -|>

#1


3  

This is a wrong approach ... It doesn't make sense serving 1k of pagination links! This is a horrible user experience and unnecessary load to the DOM

这是一种错误的方法......服务1k的分页链接是没有意义的!这是一种糟糕的用户体验和对DOM的不必要负担

I would recommend you go like the approach I am listing below :

我建议你像我列出的方法一样:

Say your current active page is #11

说你当前的活动页面是#11

<|- Start <- Previous - 9 - 10 - 11 - 12 - 13  - Next -> Last -|>

相关文章