PHP如何从国家和地区代码返回时区

问题描述 投票:0回答:1

我有国家代码和地区代码->如何将这两个数据转换为时区名称?

示例

<?php
echo geoip_time_zone_by_country_and_region('CA', 'QC');
//returns America/Montreal
?>

我尝试安装

geoip_time_zone_by_country_and_region

但似乎已过时(maxmind的旧版本...)

2019/2020年是否有类似的解决方案?

谢谢

php geolocation timezone geoip
1个回答
0
投票

请确保安装PECL扩展名GeoIP。

请参阅https://www.php.net/manual/en/geoip.installation.php

© www.soinside.com 2019 - 2024. All rights reserved.