Php array paging implementation method, php array paging _ PHP Tutorial

Source: Internet
Author: User
Php array paging implementation method, php array paging. Php array paging implementation method. php array paging this article describes how to implement php array paging. For your reference, the details are as follows: php $ arr_clickarray (array (implementation of clic php array paging, php array paging)

This article describes how to implement php array paging. We will share this with you for your reference. The details are as follows:

<? Php $ arr_click = array ('clicks' => 3, 'clickdate' => '2017-10-11 '), array ('clicks' => 2, 'clickdate' => '2017-10-10 '), array ('clicks' => 3, 'clickdate' => '2017-10-09 '), array ('clicks' => 4, 'clickdate' => '2017-10-08 '), array ('clicks' => 5, 'clickdate' => '2017-10-13 '), array ('clicks' => 7, 'clickdate' => '2017-10-14 '), array ('clicks' => 6, 'clickdate' => '2017-10-15 '), array ('clicks' => 9, 'Clickdate' => '2017-10-16 '),); if (! Isset ($ _ GET ['Page']) {$ page = 1 ;}else {$ page =$ _ GET ['Page'] ;}$ size = 3; // number of records displayed per page $ pnum = ceil (count ($ arr_click)/$ size); // total number of pages, ceil () the function is used to evaluate the smallest integer greater than the number. // use the array_slice (array, offset, length) function to retrieve a value in the array according to the conditions. array (array ), offset (starting position of the element), length (group length) $ newarr = array_slice ($ arr_click, ($ page-1) * $ size, $ size ); for ($ I = 0; $ I
 ";}?> <? Phpif (! Isset ($ _ GET ['Page']) | $ _ GET ['Page'] <= 1) {?> Previous Page <? Php} else {?> "> Previous Page <? Php }?> <? Php if ($ _ GET ['Page'] >=$ pnum) {?> "> Next page <? Php} else {?> "> Next page <? Php }?>

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.