downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

geoip_db_get_all_info> <geoip_db_avail
[edit] Last updated: Fri, 25 May 2012

view this page in

geoip_db_filename

(PECL geoip >= 1.0.1)

geoip_db_filename対応する GeoIP データベースのファイル名を返す

説明

string geoip_db_filename ( int $database )

geoip_db_filename() 関数は、 対応する GeoIP データベースのファイル名を返します。

これは、そのファイルが存在するかどうかを表すものではありません。 単に、ライブラリがデータベースを探す先を返すだけのものです。

パラメータ

database

データベースの形式を表す整数値。この拡張モジュールで定義している さまざまな定数 (GEOIP_*_EDITION) を使用することができます。

返り値

対応するデータベースのファイル名、あるいはエラー時に NULL を返します。

例1 geoip_db_filename() の例

これは、対応するデータベースのファイル名を出力します。

<?php

print geoip_db_filename(GEOIP_COUNTRY_EDITION);

?>

上の例の出力は以下となります。

/usr/share/GeoIP/GeoIP.dat



add a note add a note User Contributed Notes geoip_db_filename
Loc d&#39;Anterroches 17-Aug-2010 11:50
To quickly know which databases are available on your system:

<?php
$cst
= array(
            
'GEOIP_COUNTRY_EDITION' => GEOIP_COUNTRY_EDITION,
            
'GEOIP_REGION_EDITION_REV0' => GEOIP_REGION_EDITION_REV0,
            
'GEOIP_CITY_EDITION_REV0' => GEOIP_CITY_EDITION_REV0,
            
'GEOIP_ORG_EDITION' => GEOIP_ORG_EDITION,
            
'GEOIP_ISP_EDITION' => GEOIP_ISP_EDITION,
            
'GEOIP_CITY_EDITION_REV1' => GEOIP_CITY_EDITION_REV1,
            
'GEOIP_REGION_EDITION_REV1' => GEOIP_REGION_EDITION_REV1,
            
'GEOIP_PROXY_EDITION' => GEOIP_PROXY_EDITION,
            
'GEOIP_ASNUM_EDITION' => GEOIP_ASNUM_EDITION,
            
'GEOIP_NETSPEED_EDITION' => GEOIP_NETSPEED_EDITION,
            
'GEOIP_DOMAIN_EDITION' => GEOIP_DOMAIN_EDITION,
             );

foreach (
$cst as $k=>$v) {
    echo
$k.': '.geoip_db_filename($v).'  '.(geoip_db_avail($v) ? 'Available':'').'<br>';
}
?>

The only drawback of the PECL extension with respect to a pure PHP implementation is that you cannot select yourself where the database is. So, if you get a new version of the database, you need to put in the standard place and you may need root access to do so.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites