geolocation/freegeoip

ZF2 地理位置模块

dev-master 2014-08-16 04:59 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:33:43 UTC


README

Geolocation - ZF2 模块

这是一个用于地理位置的 zend framework 2 模块。

安装

主要设置

通过克隆项目

  1. 此模块可在 Packagist 上找到。在您的项目 composer.json 文件中使用

    {   
        "require": {
    		"php": ">=5.3.3",
    		"zendframework/zendframework": "*",
    		"geolocation/freegeoip": "dev-master"
    }
  2. 或者将此项目克隆到您的 ./vendor/ 目录。

用法

  1. 在控制器中

     $geoloc = $this->getServiceLocator()->get('Geolocation\Service\Geolocation'); 
     $geoloc->setIp( $ip);                                        
     $result = $geoloc->getLocation();