不使用composer安装GeoIP2-php(手动)

时间:2016-03-16 19:06:07

标签: php geolocation composer-php

如何在不使用composer和Dependencies(只需手动)的情况下安装GeoIP2 PHP,我需要包含哪些类。我应该使用__autoload函数吗? ,

<?php 

require_once 'vendor/autoload.php';
use GeoIp2\Database\Reader;

// This creates the Reader object, which should be reused across
// lookups.
$reader = new Reader('GeoLite2-City.mmdb');

// Replace "city" with the appropriate method for your database, e.g.,
// "country".

$Ips = array('105.155.240.8');

$record = $reader->city('31.147.255.255');

print($record->country->isoCode . "\n"); // 'US'


?>

0 个答案:

没有答案