PHP根据IP地址获取所在城市具体实现
内容摘要
文件目录:
ipLocation-----qqwry----------QQWry.Dat-----ipCity.class.php
ipCity.class.php文件代码:http://xiazai.phpstudy.net/201311/yuanma/qqwry.dat(phpstudy.net).z
ipLocation-----qqwry----------QQWry.Dat-----ipCity.class.php
ipCity.class.php文件代码:http://xiazai.phpstudy.net/201311/yuanma/qqwry.dat(phpstudy.net).z
文章正文
文件目录:
ipLocation
-----qqwry
----------QQWry.Dat
-----ipCity.class.php
ipCity.class.php文件代码:
http://xiazai.phpstudy.net/201311/yuanma/qqwry.dat(phpstudy.net).zip
include FCPATH . 'plugin/ipLocation/ipCity.class.php';
$city = new ipCity();
$addr = $city->getCity( '172.0.0.1' );
echo $addr; // echo 本地地址
使用演示:
复制代码 代码如下:
include FCPATH . 'plugin/ipLocation/ipCity.class.php';
$city = new ipCity();
$addr = $city->getCity( '172.0.0.1' );
echo $addr; // echo 本地地址
代码注释