我想做一些简单的结果分页,但我没有客户端开发经验。
所以我检查了现有网站是如何通过:View Source
of IE
.
在youtube
我看到以下内容:
它每页显示 20 个结果并提供 7 个页面的链接。
来源如下:
<a href="/results?search_query=html+pagination&page=1" class="yt-uix-button yt-uix-pager-button yt-uix-button-toggled yt-uix-sessionlink yt-uix-button-default" data-sessionlink="ei=73WLUfrBCsaZ8gOtjoDYAw" data-page="1" <span class="yt-uix-button-content">1</span></a>
<a href="/results?search_query=html+pagination&page=2" class="yt-uix-button yt-uix-pager-button yt-uix-sessionlink yt-uix-button-default" data-sessionlink="ei=73WLUfrBCsaZ8gOtjoDYAw" data-page="2" <span class="yt-uix-button-content">2</span></a>
<a href="/results?search_query=html+pagination&page=3" class="yt-uix-button yt-uix-pager-button yt-uix-sessionlink yt-uix-button-default" data-sessionlink="ei=73WLUfrBCsaZ8gOtjoDYAw" data-page="3" <span class="yt-uix-button-content">3</span></a>
<a href="/results?search_query=html+pagination&page=4" class="yt-uix-button yt-uix-pager-button yt-uix-sessionlink yt-uix-button-default" data-sessionlink="ei=73WLUfrBCsaZ8gOtjoDYAw" data-page="4" <span class="yt-uix-button-content">4</span></a>
<a href="/results?search_query=html+pagination&page=5" class="yt-uix-button yt-uix-pager-button yt-uix-sessionlink yt-uix-button-default" data-sessionlink="ei=73WLUfrBCsaZ8gOtjoDYAw" data-page="5" <span class="yt-uix-button-content">5</span></a>
<a href="/results?search_query=html+pagination&page=6" class="yt-uix-button yt-uix-pager-button yt-uix-sessionlink yt-uix-button-default" data-sessionlink="ei=73WLUfrBCsaZ8gOtjoDYAw" data-page="6" <span class="yt-uix-button-content">6</span></a>
<a href="/results?search_query=html+pagination&page=7" class="yt-uix-button yt-uix-pager-button yt-uix-sessionlink yt-uix-button-default" data-sessionlink="ei=73WLUfrBCsaZ8gOtjoDYAw" data-page="7" <span class="yt-uix-button-content">7</span></a>
<a href="/results?search_query=html+pagination&page=2" class="yt-uix-button yt-uix-pager-button yt-uix-sessionlink yt-uix-button-default" data-sessionlink="ei=73WLUfrBCsaZ8gOtjoDYAw" data-page="2"><span class="yt-uix-button-content">Next »</span></a>
所以我假设这sessionlink
就像一个会话标识符?
我怎么能在我的服务器端代码中使用它?
又何必Next
指/results?search_query=html+pagination&page=2
?