对IpLocation类进行了封装,方便调用。默认使用的是gbk纯真IP地址库文件QQWry。function IP($ip='',$charset='gbk',$file='QQWry.dat') {<br>
static $_ip = array();<br>
if(isset($_ip[$ip])) {<br>
return $_ip[$ip];<br>
}else{<br>
import("ORG.Net.IpLocation");<br>
$iplocation = new IpLocation($file);<br>
$location = $iplocation->getlocation($ip);<br>
$_ip[$ip] = $location['country'].$location['area'];<br>
}<br>
if('utf-8' != $charset) {<br>
$_ip[$ip] = iconv($charset,'utf-8',$_ip[$ip]);<br>
}<br>
return $_ip[$ip];<br>
}
AD:真正免费,域名+虚机+企业邮箱=0元