PHP·ÖÒ³ÏÔʾÖÆ×÷Ïêϸ½²½â
1¡¢Ç°ÑÔ
·ÖÒ³ÏÔʾÊÇÒ»Öַdz£³£¼ûµÄä¯ÀÀºÍÏÔʾ´óÁ¿Êý¾ÝµÄ·½·¨£¬ÊôÓÚweb±à³ÌÖÐ×î³£´¦ÀíµÄʼþÖ®Ò»¡£¶ÔÓÚweb±à³ÌµÄÀÏÊÖÀ´Ëµ£¬±àдÕâÖÖ´úÂëʵÔÚÊǺͺôÎüÒ»Ñù×ÔÈ»£¬µ«ÊǶÔÓÚ³õѧÕßÀ´Ëµ£¬³£³£¶ÔÕâ¸öÎÊÌâÃþ²»×ÅÍ·Ð÷£¬Òò´ËÌصØ׫д´ËÎĶÔÕâ¸öÎÊÌâ½øÐÐÏêϸµÄ½²½â£¬Á¦ÇóÈÿ´ÍêÕâƪÎÄÕµÄÅóÓÑÔÚ¿´ÍêÒÔºó¶ÔÓÚ·ÖÒ³ÏÔʾµÄÔÀíºÍʵÏÖ·½·¨ÓÐËùÁ˽⡣±¾ÎÄÊʺϳõѧÕßÔĶÁ£¬ËùÓÐʾÀý´úÂë¾ùʹÓÃphp±àд¡£
2¡¢ÔÀí
Ëùν·ÖÒ³ÏÔʾ£¬Ò²¾ÍÊǽ«Êý¾Ý¿âÖеĽá¹û¼¯ÈËΪµÄ·Ö³ÉÒ»¶ÎÒ»¶ÎµÄÀ´ÏÔʾ£¬ÕâÀïÐèÒªÁ½¸ö³õʼµÄ²ÎÊý£º
ÿҳ¶àÉÙÌõ¼Ç¼£¨$PageSize£©£¿
µ±Ç°Êǵڼ¸Ò³£¨$CurrentPageID£©£¿
ÏÖÔÚÖ»ÒªÔÙ¸øÎÒÒ»¸ö½á¹û¼¯£¬ÎҾͿÉÒÔÏÔʾij¶ÎÌض¨µÄ½á¹û³öÀ´¡£
ÖÁÓÚÆäËûµÄ²ÎÊý£¬±ÈÈ磺ÉÏÒ»Ò³£¨$PreviousPageID£©¡¢ÏÂÒ»Ò³£¨$NextPageID£©¡¢×ÜÒ³Êý£¨$numPages£©µÈµÈ£¬¶¼¿ÉÒÔ¸ù¾ÝÇ°±ßÕ⼸¸ö¶«Î÷µÃµ½¡£
ÒÔmysqlÊý¾Ý¿âΪÀý£¬Èç¹ûÒª´Ó±íÄÚ½Øȡij¶ÎÄÚÈÝ£¬sqlÓï¾ä¿ÉÒÔÓãºselect * from table limit offset, rows¡£¿´¿´ÏÂÃæÒ»×ésqlÓï¾ä£¬³¢ÊÔһϷ¢ÏÖÆäÖеĹæÂÊ¡£
Ç°10Ìõ¼Ç¼£ºselect * from table limit 0,10
µÚ11ÖÁ20Ìõ¼Ç¼£ºselect * from table limit 10,10
µÚ21ÖÁ30Ìõ¼Ç¼£ºselect * from table limit 20,10
……
ÕâÒ»×ésqlÓï¾äÆäʵ¾ÍÊǵ±$PageSize=10µÄʱºòÈ¡±íÄÚÿһҳÊý¾ÝµÄsqlÓï¾ä£¬ÎÒÃÇ¿ÉÒÔ×ܽá³öÕâÑùÒ»¸öÄ£°å£º
XML/HTML´úÂë
select * from table limit ($CurrentPageID - 1) * $PageSize, $PageSize
ÄÃÕâ¸öÄ£°å´úÈë¶ÔÓ¦µÄÖµºÍÉϱßÄÇÒ»×ésqlÓï¾ä¶ÔÕÕһϿ´¿´ÊDz»ÊÇÄÇô»ØÊ¡£¸ã¶¨ÁË×îÖØÒªµÄÈçºÎ»ñÈ¡Êý¾ÝµÄÎÊÌâÒÔºó£¬Ê£Ïµľͽö½öÊÇ´«µÝ²ÎÊý£¬¹¹ÔìºÏÊʵÄsqlÓï¾äÈ»ºóʹÓÃphp´ÓÊý¾Ý¿âÄÚ»ñÈ¡Êý¾Ý²¢ÏÔʾÁË¡£ÒÔÏÂÎÒ½«ÓþßÌå´úÂë¼ÓÒÔ˵Ã÷¡£
3¡¢¼òµ¥´úÂë
ÇëÏêϸÔĶÁÒÔÏ´úÂ룬×Ô¼ºµ÷ÊÔÔËÐÐÒ»´Î£¬×îºÃ°ÑËüÐÞ¸ÄÒ»´Î£¬¼ÓÉÏ×Ô¼ºµÄ¹¦ÄÜ£¬±ÈÈçËÑË÷µÈµÈ¡£
<?php
// ½¨Á¢Êý¾Ý¿âÁ¬½Ó
$link = mysql_connect("localhost", "mysql_user", "mysql_password")
or die("Could not connect: " . mysql_error());
// »ñÈ¡µ±Ç°Ò³Êý
if( isset($_GET['page']) ){
&nbs
Ïà¹ØÎĵµ£º
ÏÈ˵ͨ¹ýjavascript·¢ËÍʱµÄÂÒÂëÎÊÌ⣬Èç¹û·¢Ë͵ÄÊÇÖÐÎÄ£¬¾ÍÒªÓÃescapeÕâ¸öº¯Êý´¦Àí£¬±ÈÈ磺
£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
var url="testurl.php?name="+"¸Õ¸Õ";
£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
ÄÇô¾ÍÒª¸Ä³É
£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
var url="testurl. ......
ÉùÃ÷£º²¹³ä·ÒëÁËÔÌûÖм¸´¦Î´·Òë´¦¡£
---------------------------------------------------- תÌû¿ªÊ¼ -------------------------------------------------------
PHPÖеÄCURLº¯Êý¿â£¨Client URL Library Function£©
curl_close - ¹Ø±ÕÒ»¸öcurl»á»°
curl_copy_handle - ¿½±´Ò»¸öcurlÁ¬½Ó×ÊÔ´µÄËùÓÐÄÚÈݺ ......
a:
ΪʲôҪʹÓûº´æ¼¼Êõ£¿ÀíÓɺܼòµ¥£ºÌá¸ßЧÂÊ¡£ÔÚ³ÌÐò¿ª·¢ÖУ¬»ñÈ¡ÐÅÏ¢µÄ·½Ê½Ö÷ÒªÊDzéѯÊý¾Ý¿â£¬³ý´ËÒÔÍ⣬Ҳ¿ÉÄÜÊÇͨ¹ýWeb Services»òÕß±ðµÄijÖÖ·½·¨£¬ÎÞÂÛÄÄÖÖ·½·¨£¬ÔÚ´óÁ¿µÄ²¢·¢·ÃÎÊÃæÇ°£¬ËüÃǶ¼¿ÉÄܳÉΪЧÂʵÄÆ¿¾±£¬ÎªÁ˽â¾öÕâЩÎÊÌ⣬ÈËÃÇÌá³öÁ˺ܶà½â¾ö·½°¸£¬ÆäÖÐÒ» ЩÊÇÀûÓÃÓÅ»¯Èí¼þ£¨È磺APC£¬Eaccelerator£¬ ......
ÔÚwindows ÏÂÅäÖÃPHPʹÓÃORACLEÊý¾Ý¿âÒªµã
ÔÚwindowÏ£¬¾³£ÓÃapache + PHP À´×öÓ¦ÓÃƽ̨£¬µ«ÊÇÈç¹ûʹÓÃoracle×öºǫ́Êý¾Ý¿â£¬µ«ÓÖûÓа²×°ÓÐoracle¿Í»§¶Ë£¬ÏÂÃæµÄÅäÖÿÉÒԲο¼
1¡¢ÔÚûÓа²×°oracleµÄ»úÆ÷ÉÏ£¬PHPÎÞ·¨¼ÓÔØphp_oci8.dllÄ£¿é£¬ÔÒòÊÇphp_oci8.dllÒÀÀµµÄÏà¹Ø×é¼þûÓÐÕÒµ½¡£
ÄãÕýÈ·ÉèÖÃÁË ......