How does one implement paging without querying the database?

Source: Internet
Author: User
Php Beginners use php to call APIs. The total number of data records and 10 pieces of data on each page are displayed. How to Write paging? I hope to give a demo or code. Thank you ~! Php Beginners use php to call APIs. The total number of data records and 10 pieces of data on each page are displayed. How to Write paging? I hope to give a demo or code. Thank you ~!

Reply content:

Php Beginners use php to call APIs. The total number of data records and 10 pieces of data on each page are displayed. How to Write paging? I hope to give a demo or code. Thank you ~!

Https://segmentfault.com/q/1010000002464834
Imitating the paging navigation of Baidu search results.


  '; If ($ total_pagas = 0) {echo'The query result is empty.
';} Else if ($ page >$ total_pagas | $ page <= 0) {?> Beginning
"> Last
Page 1st (the first page is displayed without this page)
'; $ Page = 1; if ($ total_pagas >=$ page + 4) {for ($ I = $ page + 1; $ I <= $ page + 4; $ I ++) {// echo $ I;?> "> Page
"> Next page
"> Page
"> Next page
Beginning
"> Last
"> Previous Page
"> Page
"> Previous Page
"> Page
Page '. $ page.' (current page)
'; If ($ total_pagas >=$ page + 4) {for ($ I = $ page + 1; $ I <= $ page + 4; $ I ++) {// echo $ I;?> "> Page
"> Next page
"> Page
"> Next page


  $ Val) {// display paging data}?>

This is probably the case...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.