PHP Simple implementation of the method of array paging, PHP array paging
This paper introduces a simple way to implement array paging in PHP. Share to everyone for your reference, as follows:
First, learn more and read the handbook.
Using PHP's own functions can solve some difficult problems
<?php/** * Created by JetBrains Phpstorm. * User:administrator * date:13-6-11 * Time: Morning 11:43 * To change this template use File | Settings | File Templates. */header ("Content-type:text/html;charset=utf-8"); $array =array ( 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25); $page =$_get[' page '? (int) $_get[' page ': ' 0 '; $size =5; $pnum = Ceil (count ($array)/$size); $newArray = Array_slice ($array, ($page-1) * $size, $ ), foreach ($newArray as $key + $val) { echo "$val \ n";} echo "
"echo" first page \ n "; $str ="; for ($i =1; $i <= $pnum-1; $i + +) { echo "$i \ n";} echo "last page \ n";? >
More interested in PHP related content readers can view this site: "PHP array" operation Skills Daquan, "PHP Regular Expression Usage Summary", "Php+ajax Tips and Applications Summary", "PHP operation and operator Usage Summary", "PHP Network Programming Skills Summary", " PHP Basic Grammar Introductory tutorial, PHP Operations Office Document Tips summary (including word,excel,access,ppt), PHP date and Time usage summary, PHP Object-oriented Programming primer tutorial, PHP string Usage Summary "," Introduction to Php+mysql Database Operation "and" PHP common database Operation Skills Summary "
I hope this article is helpful to you in PHP programming.
http://www.bkjia.com/PHPjc/1125256.html www.bkjia.com true http://www.bkjia.com/PHPjc/1125256.html techarticle PHP Simple implementation of the method of the array paging, PHP array paging in this paper, the example of PHP simple implementation of the method of array paging. Share to everyone for reference, as follows: first of all to learn things to ...