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...