代码之家  ›  专栏  ›  技术社区  ›  The Mighty Rubber Duck

如何从zendframework的Zend_语言环境中获取元区域列表?

  •  3
  • The Mighty Rubber Duck  · 技术社区  · 14 年前

    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"/>
            (...)
    

    我想这很适合我的需要,我想把这个单子提取出来。 与其破解我的库版本,我想知道是否有一种方法可以通过普通的方式获取这个列表(似乎没有办法,而且这个元区域信息似乎在任何地方都不会被查询)。

    2 回复  |  直到 14 年前
        1
  •  1
  •   Gordon Haim Evgi    14 年前

    我不知道你要找哪一个,但你最好的候选人是

    $locale->getTranslationList('TerritoryToTimezone');
    

    TerritoryToTimezone 可与参考手册中描述的任何标识符进行交换 Zend_Locale subchapter Obtaining Localized Data .

    use DOM to parse the XML .

        2
  •  0
  •   Gordon Haim Evgi    14 年前

    您可以使用时区\u缩写符\u list()、时区\u标识符\u list()。。。 here