PHP code example of juckzhang / yii2-ip-look-up

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

    

juckzhang / yii2-ip-look-up example snippets


/** QiNiu **/
return [
    'components' => [
      'ipLookUp' => [
          'class' => 'juckzhang\ipLookUp\IpLookUp',
          'file'  => 'qqwry.dat'//纯真ip库文件地址
    ],
]

1、更新纯真ip库文件
\Yii::$app->get('ipLookUp')->updateQqWryFile();

2、根据ip返回城市信息
\Yii::$app->get('ipLookUp')->ipLookUp($ip);