PHP code example of eddy / ip2region
1. Go to this page and download the library: Download eddy/ip2region 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/ */
eddy / ip2region example snippets
//在本项目的 src/data 目录下已经生成好了一份 ip2region.db 文件,可以复制到你的项目直接使用。当然你也可以自己生成一份最新的文件。
$ip2region_db_file_location = 'ip2region.db';
$client = new eddy\Ip($ip2region_db_file_location);
$data = $client->memorySearch('220.168.85.64');
print_r($data);