PHP·ÖÒ³Àà
½ñÌìÈ¥XX¹«Ë¾ÃæÊÔÁË£¬¸Ð¾õºÜ²»ÀíÏë¡£ÒòΪÕâÒ»¶Îʱ¼ä¶¼ÔÚ¼ÓÉîZend Framework£¬¶¼Ã»Á·Ï°³£Óú¯ÊýºÍ·½·¨ÁË¡£
±ÊÊԻشðµÄ²»Ì«ºÃ£¬ÌرðÊÇJS²¿·Ö£¬Ò²ÊÇÐí¾Ã¶¼Ã»¸´Ï°µÄÔÒò¡£
ÉÏ»úÌâÄ¿ÊÇҪдһ¸ö·Âgoogle·ÖÒ³µÄÀ࣬µ±ÒªÈ¡ÀàËÆ9/2µÄ×î´óÕûÊý£¬È´ÔõôҲÏë²»Æðº¯ÊýceilµÄÃû×Ö£¬ÔÎÁË°ëÌì¡£
×îºó²âÊÔ³ÌÐòû´íÎ󣬵«ÊǾÍÊDz»ÄÜÕý³£ÏÔʾ£¬ºóÀ´£¨»Ø¼Òºó£©Ò»²é²ÅÖªµÀÊÇÓï¾ä£ºfor($i=0;$i++;$i<9)д´íÁË£¬ÓÚÊÇϾöÐÄÖØÐÂдһ±é£¬ÓÚÊǾÍÓÐÁËÏÂÃæµÄ´úÂëÁË£º
<?php
/*
ÏÔʾÑùʽÈçÏ£º
[1] 2 3 4 5 6 7 8 9 10 ...100 ÏÂÒ³ βҳ
Ê×Ò³ ÉÏÒ³ 1..12 13 14 15 [16] 17 18 19 20 ...100 ÏÂÒ³ βҳ
Ê×Ò³ ÉÏÒ³ 1..92 93 94 95 96 97 98 [99] 100
ʹÓ÷½·¨£º
$currentPage = $_GET['page']?$_GET['page']:1;
$pagediv = new pagediv(500, 10, 11, $currentPage, 'test.php?page=');
$pagediv->show();
*/
class pagediv
{
public $part1;
public $part2;
public $part3;
public $part4;
public $part5;
/*
¶ÔÏÂÃæµÄ·ÖÒ³ÏÔʾ½øÐзָî:
Ê×Ò³ ÉÏÒ³ 1..12 13 14 15 [16] 17 18 19 20 ...100 ÏÂÒ³ βҳ
$part1 : Ê×Ò³ ÉÏÒ³
$part2 : 1..
$part3 : 12 13 14 15 [16] 17 18 19 20
$part4 : ...100
$part5 : ÏÂÒ³ βҳ
*/
public $allPage; //×ÜÒ³Êý
public $allRocords; //×ܼǼÊý
public $perPage; //ÿҳ¼Ç¼Êý
public $showPagesNo; //ÏÔʾ·ÖÒ³À¸µÄ×ÜÒ³ÂëÊý ÏÔʾÑùʽÀï¹²ÓÐ11¸ö
public $currentPage; //µ±Ç°Ò³
public $urlModel; //UrlÁ´½ÓÑùʽ
public $startHidden; //³öÏÖ 1... ʱµÄÒ³Êý ¿ªÊ¼Òþ²ØÖмäÒ³
public $endHidden; //³öÏÖ ...100 ʱµÄÒ³Êý ½áÊøÒþ²ØÖмäÒ³
public function __construct($allRocords, $perPage, $showPagesNo, $currentPage, $urlModel){
$this->allRocords = $allRocords;
$this->perPage = $perPage;
$this->showPagesNo = $showPagesNo;
$this->currentPage = $currentPage;
$this->urlModel = $urlModel;
$this->allPage = $this->getAllPage();
&
Ïà¹ØÎĵµ£º
ʵÀýÓ¦Óãº
1<?
2require_once('../libs/classes/page.class.php');
3$page=new page(array('total'=>1000,'perpage'=>20));
4echo 'mode:1<br>'.$page->show();
5echo '<hr>mode:2<br>'.$page->show(2);
6echo '<hr>mode:3<br>'.$page->show(3);
7echo '&l ......
ÖйúµÚÒ»µµÂÌÉ«PHP×ÊÔ´·ÖÏíÃÅ»§,רעÓÚ´´ÐºÍÔ´´ÀàÔ´Âëphp×ÊÔ´£¬Ô´´ÊÓƵphp×ÊÔ´£¬Ô´´µäÐÍÄ£¿éphp×ÊÔ´£¬Ô´´php¿ªÔ´×ÊÔ´£¬Ô´´php½Ì³Ì×ÊÔ´£¬Ô´´Íøվģ°å×ÊÔ´ ¡£ÍøÕ¾µØÖ· http://www.phpzy.com/
ÂÌÉ«php×ÊÔ´ ......
phpÊÇÒ»ÖÖ¿ª·ÅÔ´´úÂ롢ǶÈëʽ·þÎñÆ÷¶ËµÄ½Å±¾ÓïÑÔ¡£
1¡¢PHPÒ²ÊÇǶÈëʽCGIÓïÑÔ¡£PHP4ÊDZ»·â×°ÔÚ±ê¼ÇÖеÄǶÈëʽÓïÑÔ£¬Äã¿ÉÒÔÇáÒ×µØÔÚPHPºÍHTMLÖ®¼ä½øÐÐת»»£¬¶ø²»±ØʹÓôóÁ¿´úÂëÒÔÊä³öHTML¡£Í¨ÓÃÍø¹Ø½Ó¿Ú(CGI)ÔÊÐíÓû§±àдÄܲúÉúHTMLÒÔ¼°¶¯Ì¬´¦ÀíÍøÒ³Êý¾ÝµÄ¼ÆËã»ú³ÌÐò¡£PHP¿ÉÒÔ±»¹éÀàΪCGI¡£
2¡¢Ó¦ÓÃPHPµÄÈý¸öÁìÓò£º(1)·þÎñÆ ......