PHP code example of guanhui07 / ip-address

1. Go to this page and download the library: Download guanhui07/ip-address library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

guanhui07 / ip-address example snippets



//ipv4地址
$ip = '127.0.0.1';
$ipdb = new \PhpCpm\IpAddress\IpRegion();
$driver  = \PhpCpm\IpAddress\drivers\IpIp::class;

$ipdb->drvier($driver)->init($ip)->getMap();

//部分库需要注册开发者账号申请AccessKey
$driver = \PhpCpm\IpAddress\drivers\Baiduyun::class;
$ipdb->drvier($driver)->setToken('testToken')->init($ip)->getMap();

composer