¹ØÓÚphpÐÔÄܵ÷Óŵļ¸Ìõ½¨Òé
×î½üÔÚ´¦ÀíСÓãÉçÇøµÄ¿ª·¢¹ý³Ì£¬Óöµ½³ÌÐòµÄÐÔÄÜÎÊÌ⣬ÔÚ½â¾öÕâ¸öÎÊÌâµÄʱºòÌá³ö¼¸¸ö½¨Ò飺
1¡¢´¦Àíwhile/foreachÖ®ÀàµÄÑ»·ÒªÌرð×¢Ò⣬ÒòΪÕâ¸öÑ»·¿ÉÄÜÊǺü¸Ç§´ÎµÄ£¬ËùÒÔÀïÃæµÄÿ¾äÓï¾ä¶¼Òª×¢ÒâÖ´ÐÐËÙ¶È£¬Òª¾«¼ò¡£»¹Óиö²»ºÃµÄϰ¹ßÒ»¶¨Òª×¢Ò⣬²»ÒªÔÚÕâ¸öÖÐд̫³¤µÄ³ÌÐò£¬ÒòΪÕâ¿ÉÄÜÈÃÄãÔÚ¼¸°ÙÐеĴúÂëÖÐÃÔʧ£¬ÂýÂýµØÃÔʧÁË£¬Íü¼Ç×Ô¼ºÔÚÑ»·ÖС£Èç¹ûÔÚÑ»·ÖÐÓгöÏÖrequire_once/requireͬһ¸öÎļþ¡¢»¹ÓÐÒª¼ì²éÆäÖеÄmysql²éѯÓï¾äÒ»¶¨Òª°ÑÕⲿ·Ý´úÂëÒÆ³öÑ»·
2¡¢²»ÒªÔÚÑ»·ÖÐÆµ·±¶Áдcookie,ÕâÒª½øÐÐio²Ù×÷£¬»áÓ°Ïì³ÌÐòÖ´ÐÐʱ¼ä
3¡¢²»Òª½¨Á¢Ò»¸ö£¬º¬Óм¸Ç§ÐÐÔªËØµÄÊý×飬ÀýÈçÌû×Ó°æ¿éÐÅÏ¢»º´æ£¬°æ¿é¶àµÄʱºòºÜÈÝÒ׳öÏÖÕâÖÖÇé¿ö
4¡¢¾¡Á¿Ê¹ÓÃphpÄÚÖú¯Êý£¬²»ÒªÓÖÖØ¸´ÖÆÔì³µÂÖ£¬ÒòΪÄÚÖú¯Êý»ù±¾ÉÏЧÂÊ»á±È×Ô¼ºÐ´µÄ¸ß
5¡¢ÀûÓø÷ÖÖ¹¤¾ß£¨xhprof/xdebug/microtime()£©À´·ÖÎö³ÌÐòÖ´ÐУ¬²éÕÒÓ°Ïìʱ¼äµÄ³ÌÐò¶Î,ÔÙ½øÐÐÓÅ»¯
6¡¢ÔÚʹÓÃÊý×éÔªËØÊ±ºò£¬¾¡Á¿$arr['el']¸ñʽ£¬²»ÒªÓÃ$arr[el],ÒòΪºóÕß»¹»áÈ¥¼ì²âÕâ¸öelÊDz»Êdz£Á¿
Ïà¹ØÎĵµ£º
<?
/*****************************************************************************/
/* */
/* file type: °üº¬Îļþ£¬½¨Òéºó׺Ϊ.inc */
/* */
/* file name: cart.inc */
/* */
/* Description: ¶¨ÒåÒ»¸ö¹º³µÀà */
/* */
/* Func list : class cart */
/* */
/* author : bigeagle */
/* */ ......
×ÛºÏÍøµêϵͳÊÇÓÉEÒ×ÍøÂç(68ws.cn)»ùÓÚphp+mysql¿ª·¢£¬¼æÈݸ÷ÀàÉÌÆ·µÄ·¢²¼¡¢Õ¹Ê¾ºÍ¶©¹º¡£³ýÁ˾ßÓÐÍêÉÆµÄÉÌÆ·ÀàÐ͹ÜÀí¡¢ÉÌÆ·¹ÜÀí¡¢ÅäËÍÖ§¸¶¹ÜÀí¡¢¶©µ¥¹ÜÀí¡¢»áÔ±·Ö×é¡¢»áÔ±¹ÜÀí¡¢²éѯͳ¼ÆºÍ¶àÏîÉÌÆ·´ÙÏú¹¦ÄÜ£¬»¹¾ßÓÐÍêÕûµÄÎÄÕ¡¢Í¼ÎÄ¡¢ÏÂÔØ¡¢µ¥Ò³¡¢¹ã¸æ·¢²¼µÈÍøÕ¾ÄÚÈݹÜÀí¹¦ÄÜ¡£ÏµÍ³¾ßÓо²Ì¬HTMLÉú³É¡¢UTF-8¶àÓïÑÔÖ§³ ......
1£¬°ó¶¨²ÎÊý
$mysqli=new mysqli($host,$user,$pass,$db);
if(mysqli_connect_errno()){
echo 'Á¬½Ó³öÏÖÒì³£ÁË:'.mysqli_connect_error();
exit(0); }
......
¿Í»§¶ËIPÏà¹ØµÄ±äÁ¿
1. $_SERVER['REMOTE_ADDR']; ¿Í»§¶ËIP£¬ÓпÉÄÜÊÇÓû§µÄIP£¬Ò²ÓпÉÄÜÊÇ´úÀíµÄIP¡£
2. $_SERVER['HTTP_CLIENT_IP']; ´úÀí¶ËµÄIP£¬¿ÉÄÜ´æÔÚ£¬¿ÉαÔì¡£
3. $_SERVER['HTTP_X_FORWARDED_FOR']; Óû§ÊÇÔÚÄĸöIPʹÓõĴúÀí£¬¿ÉÄÜ´æÔÚ£¬¿ÉÒÔαÔì¡£
·þÎñÆ÷¶ËIPÏà¹ØµÄ±äÁ¿
1. $SERVER_NAME£¬ÐèҪʹÓú¯Êýget ......
ÊÖ»úÍøµê¹ÜÀíϵͳÊÇÓÉEÒ×ÍøÂç(68ws.cn)»ùÓÚphp+mysql¿ª·¢£¬¾ßÓÐÍêÉÆµÄÉÌÆ·ÀàÐ͹ÜÀí¡¢ÉÌÆ·¹ÜÀí¡¢ÅäËÍÖ§¸¶¹ÜÀí¡¢¶©µ¥¹ÜÀí¡¢»áÔ±·Ö×é¡¢»áÔ±¹ÜÀí¡¢²éѯͳ¼ÆºÍ¶àÏîÉÌÆ·´ÙÏú¹¦ÄÜ£»¾ßÓÐÆ·ÅÆÑ¡»ú¡¢ÊÖ»ú²ÎÊýרÓÃÊäÈë½çÃæµÈÊÖ»úÏúÊÛÍøÕ¾µÄÌØÉ«¹¦ÄÜ¡£ÏµÍ³¾ßÓо²Ì¬HTMLÉú³É¡¢UTF-8¶àÓïÑÔÖ§³Ö¡¢¿ÉÊÓ»¯Ä£°æÒýÇæµÈ¼¼ÊõÌØµã£¬ÊʺÏÏúÊÛ ......