Geo IP Location 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를 반환합니다.
Continent codes
Code | Continent name |
---|---|
AF |
Africa |
AN |
Antarctica |
AS |
Asia |
EU |
Europe |
NA |
North america |
OC |
Oceania |
SA |
South america |
Examples
예제 #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
기타
- geoip_country_code_by_name() - 두 글자로 된 국가 코드 받기