= 0.2.0)geoip_country_name_by_name — 獲取國(guó)家的全稱說(shuō)明geoip_country_name_by_name(string $hostname): stringgeoip_country">

geoip_country_name_by_name

(PECL geoip >= 0.2.0)

geoip_country_name_by_name獲取國(guó)家的全稱

說(shuō)明

geoip_country_name_by_name(string $hostname): string

geoip_country_name_by_name() 函數(shù)返回主機(jī)或者 IP 地址所對(duì)應(yīng)的國(guó)家名全稱。

參數(shù)

hostname

定位所用的主機(jī)或者 IP 地址。

返回值

成功,返回國(guó)家全稱,如果在數(shù)據(jù)庫(kù)中未找到相關(guān)信息則返回 false 。

范例

示例 #1 geoip_country_name_by_name() 函數(shù)的使用范例:

以下代碼將會(huì)打印 example.com 主機(jī)的定位信息。

<?php
$country 
geoip_country_name_by_name('www.example.com');
if (
$country) {
    echo 
'This host is located in: ' $country;
}
?>

以上例程會(huì)輸出:

 This host is located in: United States

參見(jiàn)