PHP code example of chibitools / ip

1. Go to this page and download the library: Download chibitools/ip 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/ */

    

chibitools / ip example snippets


/**
 * return city name of the given ip or null if not found
 * @param string $ip IP address in string format
 * @return Array|null $ipCityInfo
 */
$city = Baixing\Util\IP::getIpCityInfoCN($ip);

$city = [
    0 => '中国',
    1 => '陕西',
    2 => '西安'
];