Home > Article > Backend Development > Name codes of countries and regions around the world PHP version country code, abbreviation query function code
Copy the code The code is as follows:
function transCountryCode($code) {
$index=array('AA'=>'阿鲁巴',
'AD'=>'安道尔',
'AE'=>'阿联酋',
'AF'=>'阿富汗',
'AG'=>'安提瓜和巴布达',
'AL'=>'阿尔巴尼亚',
'AM'=>'亚美尼亚',
'AN'=>'荷属安德列斯',
'AO'=>'安哥拉',
'AQ'=>'南极洲',
'AR'=>'阿根廷',
'AS'=>'东萨摩亚',
'AT'=>'奥地利',
'AU'=>'澳大利亚',
'AZ'=>'阿塞拜疆',
'Av'=>'安圭拉岛',
'BA'=>'波黑',
'BB'=>'巴巴多斯',
'BD'=>'孟加拉',
'BE'=>'比利时',
'BF'=>'巴哈马',
'BF'=>'布基纳法索',
'BG'=>'保加利亚',
'BH'=>'巴林',
'BI'=>'布隆迪',
'BJ'=>'贝宁',
'BM'=>'百慕大',
'BN'=>'文莱布鲁萨兰',
'BO'=>'玻利维亚',
'BR'=>'巴西',
'BS'=>'巴哈马',
'BT'=>'不丹',
'BV'=>'布韦岛',
'BW'=>'博茨瓦纳',
'BY'=>'白俄罗斯',
'BZ'=>'伯里兹',
'CA'=>'加拿大',
'CB'=>'柬埔寨',
'CC'=>'可可斯群岛',
'CD'=>'刚果',
'CF'=>'中非',
'CG'=>'刚果',
'CH'=>'瑞士',
'CI'=>'象牙海岸',
'CK'=>'库克群岛',
'CL'=>'智利',
'CM'=>'喀麦隆',
'CN'=>'中国',
'CO'=>'哥伦比亚',
'CR'=>'哥斯达黎加',
'CS'=>'捷克斯洛伐克',
'CU'=>'古巴',
'CV'=>'佛得角',
'CX'=>'圣诞岛',
'CY'=>'塞普路斯',
'CZ'=>'捷克',
'DE'=>'德国',
'DJ'=>'吉布提',
'DK'=>'丹麦',
'DM'=>'多米尼加共和国',
'DO'=>'多米尼加联邦',
'DZ'=>'阿尔及利亚',
'EC'=>'厄瓜多尔',
'EE'=>'爱沙尼亚',
'EG'=>'埃及',
'EH'=>'西撒哈拉',
'ER'=>'厄立特里亚',
'ES'=>'西班牙',
'ET'=>'埃塞俄比亚',
'FI'=>'芬兰',
'FJ'=>'斐济',
'FK'=>'福兰克群岛',
'FM'=>'米克罗尼西亚',
'FO'=>'法罗群岛',
'FR'=>'法国',
'FX'=>'法国-主教区',
'GA'=>'加蓬',
'GB'=>'英国',
'GD'=>'格林纳达',
'GE'=>'格鲁吉亚',
'GF'=>'法属圭亚那',
'GH'=>'加纳',
'GI'=>'直布罗陀',
'GL'=>'格陵兰岛',
'GM'=>'冈比亚',
'GN'=>'几内亚',
'GP'=>'法属德洛普群岛',
'GQ'=>'赤道几内亚',
'GR'=>'希腊',
'GS'=>'S. Georgia and S. Sandwich Isls.',
'GT'=>'危地马拉',
'GU'=>'关岛',
'GW'=>'几内亚比绍',
'GY'=>'圭亚那',
'HK'=>'中国香港特区',
'HM'=>'赫德和麦克唐纳群岛',
'HN'=>'洪都拉斯',
'HR'=>'克罗地亚',
'HT'=>'海地',
'HU'=>'匈牙利',
'ID'=>'印度尼西亚',
'IE'=>'爱尔兰',
'IL'=>'以色列',
'IN'=>'印度',
'IO'=>'英属印度洋领地',
'IQ'=>'伊拉克',
'IR'=>'伊朗',
'IS'=>'冰岛',
'IT'=>'意大利',
'JM'=>'牙买加',
'JO'=>'约旦',
'JP'=>'日本',
'KE'=>'肯尼亚',
'KG'=>'吉尔吉斯斯坦',
'KH'=>'柬埔寨',
'KI'=>'基里巴斯',
'KM'=>'科摩罗',
'KN'=>'圣基茨和尼维斯',
'KP'=>'韩国',
'KR'=>'朝鲜',
'KW'=>'科威特',
'KY'=>'开曼群岛',
'KZ'=>'哈萨克斯坦',
'LA'=>'老挝',
'LB'=>'黎巴嫩',
'LC'=>'圣卢西亚',
'LI'=>'列支顿士登',
'LK'=>'斯里兰卡',
'LR'=>'利比里亚',
'LS'=>'莱索托',
'LT'=>'立陶宛',
'LU'=>'卢森堡',
'LV'=>'拉托维亚',
'LY'=>'利比亚',
'MA'=>'摩洛哥',
'MC'=>'摩纳哥',
'MD'=>'摩尔多瓦',
'MG'=>'马达加斯加',
'MH'=>'马绍尔群岛',
'MK'=>'马其顿',
'ML'=>'马里',
'MM'=>'缅甸',
'MN'=>'蒙古',
'MO'=>'中国澳门特区',
'MP'=>'北马里亚纳群岛',
'MQ'=>'法属马提尼克群岛',
'MR'=>'毛里塔尼亚',
'MS'=>'蒙塞拉特岛',
'MT'=>'马耳他',
'MU'=>'毛里求斯',
'MV'=>'马尔代夫',
'MW'=>'马拉维',
'MX'=>'墨西哥',
'MY'=>'Malaysia',
'MZ'=>'Mozambique',
'NA'=>'Namibia',
'NC'=>'New Caledonia',
' NE'=>'Niger',
'NF'=>'Norfolk Island',
'NG'=>'Nigeria',
'NI'=>'Nicaragua',
'NL'= >'Netherlands',
'NO'=>'Norway',
'NP'=>'Nepal',
'NR'=>'Nauru',
'NT'=>'Neutral Zone (Saudi Arabia-Iraq)',
'NU'=>'New Zealand',
'NZ'=>'New Zealand',
'OM'=>'Oman',
'PA'=>' Panama',
'PE'=>'Peru',
'PF'=>'French Polynesia',
'PG'=>'Papua New Guinea',
'PH'=> 'Philippines',
'PK'=>'Pakistan',
'PL'=>'Poland',
'PM'=>'Saint Pierre and Miquelon',
'PN'=> ;'Pitcairn Island',
'PR'=>'Puerto Rico',
'PT'=>'Portugal',
'PW'=>'Palau',
'PY'=>' Paraguay',
'QA'=>'Qatar',
'RE'=>'France',
'RO'=>'Romania',
'RU'=>'Russia ',
'RW'=>'Rwanda',
'SA'=>'Saudi Arabia',
'SC'=>'Seychelles',
'SD'=>'Sudan',
'SE'=>'Sweden',
'SG'=>'Singapore',
'SH'=>'Saint Helena',
'SI'=>'Slovenia',
'SJ'=>'Svalbard and Jan Mayen',
'SK'=>'Slovakia',
'SL'=>'Sierra Leone',
'SM'=>'San Marino' ,
'SN'=>'Senegal',
'SO'=>'Somalia',
'SR'=>'Suriname',
'ST'=>'Sao Tome and Principe' ,
'SU'=>'Former Soviet Union',
'SV'=>'El Salvador',
'SY'=>'Syria',
'SZ'=>'Swaziland',
'Sb'=>'Solomon Islands',
'TC'=>'Turks and Caicos Islands',
'TD'=>'Chad',
'TF'=>'Southern French Territory ',
'TG'=>'Togo',
'TH'=>'Thailand',
'TJ'=>'Tajikistan',
'TK'=>'Tokelau' ,
'TM'=>'Turkmenistan',
'TN'=>'Tunisia',
'TO'=>'Tonga',
'TP'=>'East Timor',
'TR' =>'Turkey',
'TT'=>'Trinidad and Tobago',
'TV'=>'Tuvalu',
'TW'=>'Taiwan, China Province',
'TZ'=>'Tanzania',
'UA'=>'Ukraine',
'UG'=>'Uganda',
'UK'=>'United Kingdom',
'UM '=>'U.S. Overseas Territories',
'US'=>'United States',
'UY'=>'Uruguay',
'UZ'=>'Uzbekistan',
'VA'=> ;'Vatican',
'VC'=>'Saint Vincent and the Grenadines',
'VE'=>'Venezuela',
'VG'=>'British Virgin Islands',
'VI'=>'U.S. Virgin Islands',
'VN'=>'Vietnam',
'VU'=>'Vanuaro',
'WF'=>'Varis and Fortuna',
'WS'=>'Western Samoa',
'YE'=>'Yemen',
'YT'=>'Mayotte',
'YU'= >'Yugoslavia',
'ZA'=>'South Africa',
'ZM'=>'Zambia',
'ZR'=>'Zaire',
'ZW'=>'Zimbabwe ');
$code=strtoupper($code);
$name=$index[$code];
if (emptyempty($name)) {
return null;
}
return $name;
}
?> ;
The above introduces the name codes of countries and regions in the world, the PHP version of the country code, and the abbreviation query function code, including the content of the name codes of countries and regions in the world. I hope it will be helpful to friends who are interested in PHP tutorials.