PHP INTL国家/地区代码2个符合国家名称的字符

您所在的位置:网站首页 SR国家代码 PHP INTL国家/地区代码2个符合国家名称的字符

PHP INTL国家/地区代码2个符合国家名称的字符

2023-03-25 00:06| 来源: 网络整理| 查看: 265

百度翻译此文   有道翻译此文 问题描述

I'm trying to convert, using PHP, 2 characters country codes (ISO 3166-1) to country names, or intl country codes, so I can translate the country name.

Using Locale::getDisplayRegion needs locale codes for languages (nl_NL) and all I have is the 2 characters country code. I don't want to rely on Webservices, but I can think on the geoip extension (I can't find a solution using it anyway).

Is there any way to get the 2 chars country code and convert it to localized country name without using webservices or external resources?

(I was using zend_locale some time ago, but zf2 does not have that functionality)

推荐答案

You don't have to have a fully-formed locale for the first parameter. This makes the function useful for getting the country name from any locale:



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3