array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.geoip-continent-code-by-name.php', 1 => 'geoip_continent_code_by_name', ), 'up' => array ( 0 => 'ref.geoip.php', 1 => 'GeoIP 関数', ), 'prev' => array ( 0 => 'function.geoip-asnum-by-name.php', 1 => 'geoip_asnum_by_name', ), 'next' => array ( 0 => 'function.geoip-country-code-by-name.php', 1 => 'geoip_country_code_by_name', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/geoip/functions/geoip-continent-code-by-name.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL geoip >= 1.0.3)
geoip_continent_code_by_name — 二文字の大陸コードを取得する
geoip_continent_code_by_name() 関数は、 ホスト名あるいは IP アドレスに対応する二文字の大陸コードを返します。
hostname
場所を探す対象となるホスト名あるいは IP アドレス。
成功した場合には二文字の大陸コード、
アドレスがデータベースで見つからない場合には false
を返します。
コード | 大陸名 |
---|---|
AF |
アフリカ |
AN |
南極 |
AS |
アジア |
EU |
ヨーロッパ |
NA |
北アメリカ |
OC |
オセアニア |
SA |
南アメリカ |
例1 geoip_continent_code_by_name() の例
これは、ホスト example.com がどこにあるのかを表示します。
<?php
$continent = geoip_continent_code_by_name('www.example.com');
if ($continent) {
echo 'This host is located in: ' . $continent;
}
?>
上の例の出力は以下となります。
This host is located in: NA