½Ó©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;
}
Ïà¹ØÎĵµ£º
×î½üÔÚдһ¸ö ǰ̨»ùÓÚ javascript. µÄ¿Í»§¶Ë ·þÎñÆ÷¶ËPHP µÄ·ÖÎöϵͳ¡£
ÔÏȼƻ®Ê¹ÓÃXMLΪÊý¾Ý½»»¥»ù´¡ µ«ÊÇ×îÖÕ»¹ÊÇÑ¡ÓýÏÇáÁ¿¼¶µÄJSON×îΪÊý¾Ý½»»¥»ù´¡¡£
Ê×ÏȽéÉÜjsonµÄ¸ñʽ
json ˵¼òµ¥ÆäʵÊÇÒ»ÖÖÊý¾Ý¸ñʽ ¸ü¼òµ¥µÄ¿ÉÒÔ¿´×ö¼òµ¥µÄÊý×é¡£
ʵÀý £¨Ò»£©
<script>
var jsonArray=[
......
×¼±¸:
lighttpd-1.4.15.tar.gz
php-4.4.2.tar.gz
mysql-5.0.20a.tar.gz
¿ªÊ¼:
1 ±àÒë°²×°lighttpd
# tar zxvf lighttpd-1.4.15.tar.gz
# cd lighttpd-1.4.15
# ls
# ./configure --prefix=/usr/local/lighttpd //´Ë²¿ÎÞ·¨±àÒëʱÌáʾ°²×°prce-devel
#&nbs ......
ÎÒÒ²ÊÇÒ»ASPתPHPµÄ³õѧÕߣ¬ÎÒÕâÀïÓÐÒ»ºÃµÄÍøÕ¾ÄÃÀ´Óë´ó¼ÒÒ»Æð·ÖÏí£¬Ï£Íû´ó¼Ò»áϲ»¶£¡
http://www.w3school.com.cn/
Ò²»¹ÓÐһЩºÃµÄÊÓƵҲÄÃÀ´Óë´ó¼ÒÒ»Æð·ÖÏí£¡
http://hi.baidu.com/ylinuxs/blog/item/4433d3354a58fed1a2cc2b26.html ......
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µÄÖ ......
ÏîÄ¿½á¹¹ÈçÉÏ
´´½¨counter.txtÎļþ
´´½¨counter1.phpÎļþ
³õʼ»¯counter.txtÎļþÖеÄÄÚÈÝ
ÊäÈë“0”
counter1.phpÎļþ´úÂë
<?php
$fp = fopen("counter.txt","r");
if ($str1==false){
$str1 = 0;
}
$str1 = fgets($fp,10);
$str1++;
fclose($fp);
$fp = ......