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
Requires
- php: >=5.4.0
- yiisoft/yii2: *
Requires (Dev)
This package is not auto-updated.
Last update: 2024-11-15 21:18:43 UTC
README
根据ip获取对应的城市名称 qqwry QQWry
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
- 给配置的组件加 IDE 自动补全 IDE autocompletion for custom components