Notice: 函数 WP_Scripts::localize 的调用方法不正确$l10n 参数必须是一个数组。若要将任意数据传递给脚本,请改用 wp_add_inline_script() 函数。 请查阅调试 WordPress来获取更多信息。 (这个消息是在 5.7.0 版本添加的。) in /data/www/appblog/wp-includes/functions.php on line 6131

根据IP查询所在地区

IpIp

官网:https://www.ipip.net/
IPv4免费地址库:https://www.ipip.net/product/client.html
Github:https://github.com/ipipdotnet
Java Demo:https://github.com/ipipdotnet/ipdb-java
PHP Demo:https://github.com/ipipdotnet/ipdb-php

public function setIp($ip)
{
    if (!class_exists('IP')) {
        include dirname(__FILE__) . "/../third_party/ipip/IP.class.php";
    }
    $loc = IP::find($ip);
    if ($loc == 'N/A') {
        return;
    }
    if (isset($loc[0]) && $loc[0] != '')
        $this->country = $loc[0];
    if (isset($loc[1]) && $loc[1] != '')
        $this->region = $loc[1];
    if (isset($loc[2]) && $loc[2] != '')
        $this->city = $loc[2];
}

GeoIp

官网:https://dev.maxmind.com/zh-hans/geoip/
GeoLite:https://dev.maxmind.com/zh-hans/geoip/legacy/geolite/
GeoLite2:https://dev.maxmind.com/zh-hans/geoip/geoip2/geolite2/
Github:https://github.com/maxmind
Java Demo:https://github.com/maxmind/GeoIP2-java
PHP Demo:https://github.com/maxmind/GeoIP2-php

在线

IP.CN:https://ip.cn/index.php?ip=8.8.8.8

上一篇 Mac安装Windows图文教程
下一篇 webp转换框架:libwebp