½Ó©PHPµÄip2longÓÐbug£¬ÇëÉ÷ÓÃ
ÏÈ¿´¿´Ï±ßÕâ¶ÎPHP´úÂë¡£Õâ¶ÎʹÓÃip2longº¯Êý£¬¶Ôͬһ¸öIP½øÐÐת»»¡£µ±È»£¬Ò²ÓÐÈËÈÏΪ58.99.011.1ºÍ058.99.011.1Ëã²»ÉϺϷ¨µÄ
IP£¬ÄǾÍReturn£¬´ËÎĶÔÄãûÓаïÖú¡£
ΪʲôҪʹÓôøÇ°µ¼ÁãµÄip£ºÎªÁËÔÚÊý¾Ý¿âÖвéѯ£¬Õâ¸ö¿ÉÒÔÔÚIP¿âÖж¨Î»µ½ipËù¶ÔÓ¦µÄλÖÃÐÅÏ¢¡£ËäȻûÓÐÕûÐ͵ÄIP²éѯЧÂʸߣ¬µ«±Ï¾¹Ö±¹Û°¡¡£
view plaincopy to clipboardprint?
<?php
echo ip2long('58.99.11.1'),"<br/>"; //Êä³öÊÇ 979569409
echo ip2long('58.99.011.1'),"<br/>"; //Êä³öÊÇ 979568897
echo ip2long('058.99.11.1'),"<br/>"; //Êä³öÊÇ¿Õ
?>
<?php
echo ip2long('58.99.11.1'),"<br/>"; //Êä³öÊÇ 979569409
echo ip2long('58.99.011.1'),"<br/>"; //Êä³öÊÇ 979568897
echo ip2long('058.99.11.1'),"<br/>"; //Êä³öÊÇ¿Õ
?>
ÔÚPHP 4.x,5.xÖÐ, ÓÐÇ°µ¼ÁãµÄipת»»µÄ½á¹û¶¼²»ÕýÈ·¡£
½â¾ö°ì·¨£¬Ê¹ÓÃд×Ô¼ºµÄº¯Êý£º
view plaincopy to clipboardprint?
function myip2long($ip){
$ip_arr = split('\.',$ip);
$iplong = (16777216 * intval($ip_arr[0])) + (65536 * intval($ip_arr[1])) + (256 * intval($ip_arr[2])) + intval($ip_arr[3]);
return $iplong;
}
Ïà¹ØÎĵµ£º
phpÁ¬½Ómysql²âÊÔ´úÂ룺
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "ʧ°Ü!";
else echo "³É¹¦!";
mysql_close();
?>
ÔËÐдúÂë³öÏÖ£ºCall to undefined function 'mysql_connect()'… ʧ°Ü
°Ù¶ÈÕÒµ½½á¹ûÊÇPHP+MYSQL »·¾³Ã ......
ÎÒÒ²ÊÇÒ»ASPתPHPµÄ³õѧÕߣ¬ÎÒÕâÀïÓÐÒ»ºÃµÄÍøÕ¾ÄÃÀ´Óë´ó¼ÒÒ»Æð·ÖÏí£¬Ï£Íû´ó¼Ò»áϲ»¶£¡
http://www.w3school.com.cn/
Ò²»¹ÓÐһЩºÃµÄÊÓƵҲÄÃÀ´Óë´ó¼ÒÒ»Æð·ÖÏí£¡
http://hi.baidu.com/ylinuxs/blog/item/4433d3354a58fed1a2cc2b26.html ......
1¡¢eregÀïÃæÊDz»ÐèÒªÒ²²»ÄÜʹÓ÷ָô·ûºÍÐÞÊηûµÄ£¬ËùÒÔeregµÄ¹¦ÄܱÈpregÒªÈõÉϲ»ÉÙ¡£
¡¡¡¡2¡¢¹ØÓÚ"."£ºµãÔÚÕýÔòÀïÃæÒ»°ãÊdzýÁË»»ÐзûÒÔÍâµÄÈ«²¿×Ö·û£¬µ«ÊÇÔÚeregÀïÃæµÄ"."ÊÇÈÎÒâ×Ö·û£¬¼´°üÀ¨»»Ðзû£¡Èç¹ûÔÚpregÀïÃæÏ£Íû"."
Äܹ»°üÀ¨»»Ðзû£¬¿ÉÒÔÔÚÐÞÊηûÖÐ ......
Apache °æ±¾£º 2.2
PHP °æ±¾£º5.2.11
EclipseÏÂÔصØÖ·£ºhttp://downloads.zend.com/pdt/all-in-one/zend-eclipse-php-galileo-SR1-win32-x86.zip
½âѹºóÔËÐÐEclipse.exe
Ñ¡Ôñ¹¤×÷¿Õ¼ä
ÎÒÑ¡ÔñÁËE:\PHPworkspace
ÕâʱҪ²åÈëÒ»²½
´ò¿ªApacheµÄÅäÖÃÎļþhttpd.conf
²éÕÒ”DocumentRoot“
ÐÞ¸ÄdocumentrootµÄÖ ......
ÎÒÔÚÉÏһƪÎÄÕÂÖн²µ½Ê¹ÓÃjavascript×ö¼¯³É±íµ¥ÑéÖ¤µÄ·½·¨£¬¶ÔÓÚ¿Í»§¶ËÑéÖ¤ÒѾ×ã¹»£¬µ«ºÃµÄ±íµ¥Ñé֤ӦͬʱÔÚ¿Í»§¶ËºÍ·þÎñÆ÷¶Ë½øÐЗ—ÕâÕýÊÇд±¾ÎĵÄÄ¿µÄ¡£
Èç¹û²ÉÓÃÒ»°ãµÄÑéÖ¤·½·¨Ó¦¸ÃÔõÑùдÄØ£¿
if ($_POST['some'] ²»Âú×ã condition) {
& ......