yii2-extension yii2-ip2location
An Yii2 extension for ip to location
lulubin/yii2-ip2location
An Yii2 extension for ip to location
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
1.Install
composer require --prefer-dist lulubin/yii2-ip2location "dev-master", (*1)
2.Usage
根据IP查询
use lulubin\ip2location\Ip2Location;
$ipLocation = new Ip2Location();
$locationModel = $ipLocation->getLocation('8.8.8.8');
print_r($locationModel->toArray());
/* Array
(
[ip] => 8.8.8.8
[begin_ip] => 8.8.8.8
[end_ip] => 8.8.8.8
[country] => 美国
[area] => 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器
)*/
升级数据库
```php
use lulubin\ip2location\QQWry;
$qqwry = new QQWry();
$qqwry->upgrade();, (*2)