geoip_db_get_all_info

(PECL geoip >= 1.0.1)

geoip_db_get_all_info锟斤拷锟斤拷锟斤拷锟斤拷 GeoIP 锟斤拷锟捷匡拷锟斤拷锟酵碉拷锟斤拷细锟斤拷息

说锟斤拷

geoip_db_get_all_info ( void ) : array

geoip_db_get_all_info() 锟斤拷锟斤拷锟斤拷锟结返锟截帮拷锟斤拷锟斤拷锟斤拷 GeoIP 锟斤拷锟捷匡拷锟斤拷锟斤拷锟斤拷细锟斤拷息锟侥讹拷维锟斤拷锟斤拷

锟斤拷使没锟叫帮拷装锟斤拷锟捷库,锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷煽锟斤拷谩锟斤拷锟斤拷锟斤拷锟斤拷谐锟斤拷锟斤拷菘锟斤拷欠锟斤拷锟矫★拷

锟斤拷锟截的癸拷锟斤拷锟斤拷锟介,锟斤拷锟斤拷值锟斤拷锟斤拷锟斤拷暮锟斤拷锟斤拷锟斤拷拢锟�

  • "available" -- 锟斤拷锟斤拷值, 锟斤拷示锟斤拷锟捷匡拷锟角凤拷锟斤拷锟�(锟斤拷慰锟� geoip_db_avail())
  • "description" -- 锟斤拷锟捷匡拷锟斤拷锟斤拷锟�
  • "filename" -- 锟斤拷锟斤拷锟较碉拷锟斤拷锟捷匡拷锟侥硷拷锟斤拷(锟斤拷慰锟� geoip_db_filename())

锟斤拷锟斤拷值

锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟介。

锟斤拷锟斤拷

Example #1 geoip_db_get_all_info() 使锟矫凤拷锟斤拷锟斤拷

锟斤拷锟铰达拷锟诫将锟斤拷锟接★拷锟斤拷锟斤拷锟斤拷锟斤拷锟较拷锟斤拷锟斤拷椤�

<?php
$infos 
geoip_db_get_all_info();
if (
is_array($infos)) {
    
var_dump($infos);
}
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

array(11) {
  [1]=>
  array(3) {
    ["available"]=>
    bool(true)
    ["description"]=>
    string(21) "GeoIP Country Edition"
    ["filename"]=>
    string(32) "/usr/share/GeoIP/GeoIP.dat"
  }

[ ... ]

  [11]=>
  array(3) {
    ["available"]=>
    bool(false)
    ["description"]=>
    string(25) "GeoIP Domain Name Edition"
    ["filename"]=>
    string(38) "/usr/share/GeoIP/GeoIPDomain.dat"
  }
}

Example #2 geoip_db_get_all_info() 使锟矫凤拷锟斤拷锟斤拷

锟斤拷锟斤拷锟绞癸拷貌锟酵拷某锟斤拷锟斤拷锟轿拷锟斤拷锟斤拷锟饺★拷锟斤拷锟斤拷锟较拷锟�

<?php
$infos 
geoip_db_get_all_info();
if (
$infos[GEOIP_COUNTRY_EDITION]['available']) {
    echo 
$infos[GEOIP_COUNTRY_EDITION]['description'];
}
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

GeoIP Country Edition