database updated at 2021-03-04 with 528560 records
database updated at 2020-05-06 with 140993 records
composer require ritaswc/zx-ip-address
Your code/你的业务代码
$result = \Ritaswc\ZxIPAddress\IPTool::query('8.8.8.8');
/*
$result = [
"start" => "8.8.8.8"
"end" => "8.8.8.8"
"addr" => array:2 [
0 => "美国"
1 => "加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器"
]
"disp" => "美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器"
]
*/
$result = \Ritaswc\ZxIPAddress\IPTool::query('240e:e9:8819:0:3::3f9');
/*
$result = [
"start" => "240e:e9:8800::"
"end" => "240e:e9:8fff:ffff::"
"addr" => array:2 [
0 => "**江苏省苏州市"
1 => "**电信IDC"
]
"disp" => "**江苏省苏州市 **电信IDC"
]
*/
$valid = \Ritaswc\ZxIPAddress\IPv4Tool::isValidAddress('114.114.114.114');
/*
$valid = true;
*/
$valid = \Ritaswc\ZxIPAddress\IPv6Tool::isValidAddress('240e:e9:8819:0:3::3f9');
/*
$valid = true;
*/
- We don't recommend forking this repository/不推荐fork此仓库
- We recommend using linux's crontab to update ip database/推荐使用linux计划任务定期更新数据库
crontab -e
# add line/增加一行,每小时更新一次
0 * * * * * cd /var/www/your_project && composer require ritaswc/zx-ip-address
- ZX IPv6地址库交流群 23871048
ZxIpAddress is licensed under MIT.