php - 我如何从 Zend Framework 的 Zend_Locale 中获取元区域列表?

标签 php zend-framework timezone

我正在尝试为 UI 组件列出所有最常见的时区。通过深入研究 Zend 框架,我发现 supplementalData.xml(由 Zend_Locale 组件使用)有一个元区域列表,其中包含首选的 TZ 数据库时区名称

    <mapTimezones type="metazones">
        <mapZone other="Acre" territory="001" type="America/Rio_Branco"/>
        <mapZone other="Afghanistan" territory="001" type="Asia/Kabul"/>
        <mapZone other="Africa_Central" territory="001" type="Africa/Maputo"/>
        <mapZone other="Africa_Central" territory="BI" type="Africa/Bujumbura"/>
        <mapZone other="Africa_Central" territory="BW" type="Africa/Gaborone"/>
        <mapZone other="Africa_Central" territory="CD" type="Africa/Lubumbashi"/>
        (...)

我认为这很适合我的需求,我想提取此列表。 我不想破解我的库版本,而是想知道是否有办法通过正常方式获取此列表(似乎没有办法,而且似乎没有在任何地方查询此元区域信息)。

谢谢!

最佳答案

我不确定你想要哪一个,但你最好的人选是

$locale->getTranslationList('TerritoryToTimezone');

其中 TerritoryToTimezone 可以与 Zend_Locale subchapter Obtaining Localized Data 的引用手册中描述的任何标识符交换.

如果这些都不能满足您的需求,您仍然可以 use DOM to parse the XML .

关于php - 我如何从 Zend Framework 的 Zend_Locale 中获取元区域列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3870289/

相关文章:

php - 如何让我的 PHP 代码显示在 html 表格中?

php - JSON 响应中的换行符非法标记?

php - 从 Zend 和 PHP 配置对 MySQL 的数据库访问时遇到问题

php - Zend2 发布请求

zend-framework - Zend 框架 : Models, 映射器;映射器中的默认字段和模型中的字段操作?

php - 如何使用 php 和特定查询添加图像

python - 如何根据 Python 中的日期(而不是当前语言环境)将 DateTime 转换为夏令时

java - 计算java中两个日期之间的天数和时区

java - UTC Unix 时间戳存储在错误时区的 Java 程序中的 HSQLDB 中

php - 如何在 CodeIgniter 的 url 中隐藏 Controller 名称?