juckzhang/yii2-ip-look-up

QQWry、upLookup、ipToCity integration for the Yii2 framework

Installs: 8

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

1.0.1 2017-04-25 02:24 UTC

This package is not auto-updated.

Last update: 2024-11-15 21:18:43 UTC


README

根据ip获取对应的城市名称 qqwry QQWry

Latest Stable Version Total Downloads License

Installation

The preferred way to install this extension is through composer.

Either run

composer require juckzhang/yii2-ip-look-up:*

or add

"juckzhang/yii2-ip-look-up": "*"

to the require section of your composer.json.

Configuration

To use this extension, simply add the following code in your application configuration:

[配置]

/** 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);

Tricks