本文整理汇总了PHP中Countries::getUsedCountries方法的典型用法代码示例。如果您正苦于以下问题:PHP Countries::getUsedCountries方法的具体用法?PHP Countries::getUsedCountries怎么用?PHP Countries::getUsedCountries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Countries
的用法示例。
在下文中一共展示了Countries::getUsedCountries方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWCARegions
public static function getWCARegions()
{
$countriesKey = Yii::t('common', 'Region');
$regions = array('World' => Yii::t('Region', 'World'), Yii::t('Region', 'Continents') => array('Asia' => Yii::t('Region', 'Asia'), 'Africa' => Yii::t('Region', 'Africa'), 'Europe' => Yii::t('Region', 'Europe'), 'North America' => Yii::t('Region', 'North America'), 'Oceania' => Yii::t('Region', 'Oceania'), 'South America' => Yii::t('Region', 'South America')), $countriesKey => array('China' => Yii::t('Region', 'China'), 'Hong Kong' => Yii::t('Region', 'Hong Kong'), 'Macau' => Yii::t('Region', 'Macau'), 'Taiwan' => Yii::t('Region', 'Taiwan')));
$countries = Countries::getUsedCountries();
uksort($countries, function ($countryA, $countryB) {
return strcmp(iconv('UTF-8', 'GBK', Yii::t('Region', $countryA)), iconv('UTF-8', 'GBK', Yii::t('Region', $countryB)));
});
foreach ($countries as $id => $country) {
$regions[$countriesKey][$id] = Yii::t('Region', $country);
}
return $regions;
}