= 1.0.3)geoip_continent_code_by_name — 獲取七大洲的大寫字母簡稱說明geoip_continent_code_by_name(string $hostname): stringge">

geoip_continent_code_by_name

(PECL geoip >= 1.0.3)

geoip_continent_code_by_name獲取七大洲的大寫字母簡稱

說明

geoip_continent_code_by_name(string $hostname): string

geoip_continent_code_by_name() 函數將會返回主機或者IP地址相對應的七大洲大寫字母簡稱。

參數

hostname

所要定位的主機或IP地址。

返回值

成功,返回兩個大寫字母組成的七大洲簡稱字符串, 如果在數據庫中未找到相關信息則返回 false 。

洲代碼
Code 洲名
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

參見