Geo IP Location geoip_time_zone_by_country_and_region
(PECL geoip >= 1.0.4)
geoip_time_zone_by_country_and_region — 일부 국가 및 지역 코드 콤보의 시간대를 반환합니다.
설명
geoip_time_zone_by_country_and_region(string $country_code
, string $region_code
= ?): string
geoip_time_zone_by_country_and_region() 함수는 국가 및 지역 코드 조합에 해당하는 시간대를 반환합니다.
미국에서 지역 코드는 각 주의 두 글자 약어에 해당합니다. 캐나다에서 지역 코드는 Canada Post가 표시한 두 자리 주 또는 지역 코드에 해당합니다.
나머지 세계의 경우 GeoIP는 FIPS 10-4 코드를 사용하여 지역을 나타냅니다. FIPS 10-4 코드의 자세한 목록은 » http://www.maxmind.com/app/fips10_4에서 확인할 수 있습니다.
이 함수는 GeoIP 라이브러리 버전 1.4.1 이상을 사용하는 경우 항상 사용할 수 있습니다. 데이터는 데이터베이스가 아닌 GeoIP 라이브러리에서 직접 가져옵니다.
매개변수
country_code
- 2자리 국가 코드(geoip_country_code_by_name() 참조)
region_code
- 두 글자(또는 숫자) 지역 코드(geoip_region_by_name() 참조)
반환 값
성공하면 표준 시간대를 반환하고 국가 및 지역 코드 조합을 찾을 수 없으면 false
를 반환합니다.
Examples
예제 #1 미국/캐나다 지역 코드를 사용하는 geoip_time_zone_by_country_and_region() 예제
그러면 CA 국가(캐나다), QC 지역(퀘벡)의 시간대가 인쇄됩니다.
<?php
$timezone = geoip_time_zone_by_country_and_region('CA', 'QC');
if ($timezone) {
echo 'Time zone for CA/QC is: ' . $timezone;
}
?>
위의 예는 다음을 출력합니다.
Time zone for CA/QC is: America/Montreal
예제 #2 FIPS 코드를 사용하는 geoip_time_zone_by_country_and_region() 예제
그러면 JP 국가(일본), 지역 01(아이치)의 시간대가 인쇄됩니다.
<?php
$timezone = geoip_time_zone_by_country_and_region('JP', '01');
if ($timezone) {
echo 'Time zone for JP/01 is: ' . $timezone;
}
?>
위의 예는 다음을 출력합니다.
Time zone for JP/01 is: Asia/Tokyo