Giter Site home page Giter Site logo

ip-location-zh's Introduction

#Ip Location Zh Build Status 数据最后更新时间为2015-8-1,预计下次更新时间为2015年10月1日。若需更新频率更高的数据,请购买该ip服务

这是一个能够通过Ip,获取该IP所在的位置,例如通过ip:1.192.94.203可以获得是**河南郑州,同样能获得国外的地址,但是没有国内详细。 注:基于ipip.net的IP数据库进行制作,该数据库每2个月更新一次,届时同步更新该插件

##特点

  1. 不配置和使用数据库,妈妈再也不用担心配置问题了
  2. 使用简单,功能专(dān)注(yī)
  3. 使用composer进行安装管理,国际标准,方便快捷,即安即用,随时更新数据库

##Install

这里不详细介绍安装composer了,大家根据链接自行安装吧!什么?没听过?你真的需要脑补了,赶快行动吧!^^

如果已经有了composer.json文件的话,直接添加"zhuzhichao/ip-location-zh": "dev-master" 到依赖,然后执行composer update。 或者直接composer require "zhuzhichao/ip-location-zh"

##Use

可以这样来用

<?phprequire 'vendor/autoload.php';


use Zhuzhichao\IpLocationZh\Ip;


var_dump(Ip::find('1.192.94.203'));
// 返回结果
array (size=4)
  0 => string '**' (length=6)
  1 => string '河南' (length=6)
  2 => string '郑州' (length=6)
  3 => string '' (length=0)

对于laravel可以这样优雅的用:

1.安装该插件

2.在app/config/app.php(Laravel 4) 或 config/app.php(Laravel 5),或者你自定义配置的app.php文件内添加

	'aliases' => array(

        'Ip'  => 'Zhuzhichao\IpLocationZh\Ip',

	),

3.然后开始在你的项目里面使用了Ip::find('1.192.94.203') 提示:在laravel中可以使用Request::getClientIp()来获取访问者的Ip

对,很简单,只用一个方法,那就是find

##Contributing 有什么新的想法和建议,欢迎提交issue或者Pull Requests

##License MIT

ip-location-zh's People

Watchers

Hao.Dongfang avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.