当前位置:多学网学习教育电脑学习编程入门PHP教程代码片段:国家代码缩写

代码片段:国家代码缩写

[08-23 22:07:21]   来源:http://www.duoxue8.com  PHP教程   阅读:186
代码片段:国家代码缩写,标签:PHP技巧,php培训,php学习,php安装,http://www.duoxue8.com
php 代码复制内容到剪贴板
  1. function instanter_country_code($fullname) {   
  2.     static $country;   
  3.     if(!isset($country)) {   
  4.     $country = array();   
  5. $country['Albania']= 'AL';   
  6. $country['Algeria']= 'DZ';   
  7. $country['Afghanistan']= 'AF';   
  8. $country['Argentina']= 'AR';   
  9. $country['United Arab Emirates']= 'AE';   
  10. $country['Aruba']= 'AW';   
  11. $country['Oman']= 'OM';   
  12. $country['Azerbaijan']= 'AZ';   
  13. $country['Egypt']= 'EG';   
  14. $country['Ethiopia']= 'ET';   
  15. $country['Ireland']= 'IE';   
  16. $country['Estonia']= 'EE';   
  17. $country['Andorra']= 'AD';   
  18. $country['Angola']= 'AO';   
  19. $country['Anguilla']= 'AI';   
  20. $country['Antigua and Barbuda']= 'AG';   
  21. $country['Austria']= 'AT';   
  22. $country['Australia']= 'AU';   
  23. $country['Macau']= 'MO';   
  24. $country['Barbados']= 'BB';   
  25. $country['Papua New Guinea']= 'PG';   
  26. $country['Bahamas']= 'BS';   
  27. $country['Pakistan']= 'PK';   
  28. $country['Paraguay']= 'PY';   
  29. $country['Palestine']= 'PS';   
  30. $country['Bahrain']= 'BH';   
  31. $country['Panama']= 'PA';   
  32. $country['Brazil']= 'BR';   
  33. $country['Belarus']= 'BY';   
  34. $country['Bermuda']= 'BM';   
  35. $country['Bulgaria']= 'BG';   
  36. $country['Northern Marianas']= 'MP';   
  37. $country['Palau']= 'PW';   
  38. $country['Benin']= 'BJ';   
  39. $country['Belgium']= 'BE';   
  40. $country['Iceland']= 'IS';   
  41. $country['Puerto Rico']= 'PR';   
  42. $country['Poland']= 'PL';   
  43. $country['Bolivia']= 'BO';   
  44. $country['Bosnia and Herzegovina']= 'BA';   
  45. $country['Botswana']= 'BW';   
  46. $country['Belize']= 'BZ';   
  47. $country['Bhutan']= 'BT';   
  48. $country['Burkina Faso']= 'BF';   
  49. $country['Burundi']= 'BI';   
  50. $country['Bouvet Island']= 'BV';   
  51. $country["Korea,Democratic People's Republic of"]= 'KP';  
  52. $country['Equatorial Guinea']= 'GQ';  
  53. $country['Denmark']= 'DK';  
  54. $country['Germany']= 'DE';  
  55. $country['East Timor']= 'TP';  
  56. $country['Togo']= 'TG';  
  57. $country['Dominican Republic']= 'DO';  
  58. $country['Dominica']= 'DM';  
  59. $country['Russia']= 'RU';  
  60. $country['Ecuador']= 'EC';  
  61. $country['Eritrea']= 'ER';  
  62. $country['France']= 'FR';  
  63. $country['Faroe Islands']= 'FO';  
  64. $country['French Polynesia']= 'PF';  
  65. $country['French Guiana']= 'GF';  
  66. $country['French Southern Territo-ries']= 'TF';  
  67. $country['Vatican']= 'VA';  
  68. $country['Philippines']= 'PH';  
  69. $country['Fiji']= 'FJ';  
  70. $country['Finland']= 'FI';  
  71. $country['Cape Verde']= 'CV';  
  72. $country['Gambia']= 'GM';  
  73. $country['Congo']= 'CG';  
  74. $country['Colombia']= 'Co';  
  75. $country['Costa Rica']= 'CR';  
  76. $country['Grenada']= 'GD';  
  77. $country['Greenland']= 'GL';  
  78. $country['Georgia']= 'GE';  
  79. $country['Cuba']= 'CU';  
  80. $country['Guadeloupe']= 'GP';  
  81. $country['Guam']= 'GU';  
  82. $country['Guyana']= 'GY';  
  83. $country['Kazakhstan']= 'KZ';  
  84. $country['Haiti']= 'HT';  
  85. $country['Korea,Republic of']= 'KR';  
  86. $country['Netherlands']= 'NL';  
  87. $country['Netherlands Antilles']= 'AN';  
  88. $country['Heard islands and Mc Donald Islands']= 'HM';  
  89. $country['Honduras']= 'HN';  
  90. $country['Kiribati']= 'KI';  
  91. $country['Djibouti']= 'DJ';  
  92. $country['Kyrgyzstan']= 'KG';  
  93. $country['Guinea']= 'GN';  
  94. $country['Guine-bissau']= 'GW';  
  95. $country['Canada']= 'CA';  
  96. $country['Ghana']= 'GH';  
  97. $country['Gabon']= 'GA';  
  98. $country['Cambodia']= 'KH';  
  99. $country['Czech Repoublic']= 'CZ';  
  100. $country['Zimbabwe']= 'ZW';  
  101. $country['Cameroon']= 'CM';  
  102. $country['Qatar']= 'QA';  
  103. $country['Cayman Islands']= 'KY';  
  104. $country['Cocos(Keeling) Islands']= 'CC';  
  105. $country['Comoros']= 'KM';  
  106. $country["Cote d'Ivoire"]= 'CI';   
  107. $country['Kuwait']= 'KW';   
  108. $country['Croatia']= 'HR';   
  109. $country['Kenya']= 'KE';   
  110. $country['Cook Islands']= 'CK';   
  111. $country['Latvia']= 'LV';   
  112. $country['Lesotho']= 'LS';   
  113. $country['Lao']= 'LA';   
  114. $country['Lebanon']= 'LB';   
  115. $country['Liberia']= 'LR';   
  116. $country['Libya']= 'LY';   
  117. $country['Lithuania']= 'LT';   
  118. $country['Liechtenstein']= 'LI';   
  119. $country['Reunion']= 'RE';   
  120. $country['Luxembourg']= 'LU';   
  121. $country['Rwanda']= 'RW';   
  122. $country['Romania']= 'RO';   
  123. $country['Madagascar']= 'MG';   
  124. $country['Malta']= 'MT';   
  125. $country['Maldives']= 'MV';   
  126. $country['Malvinas Islands (Falkland Islands)']= 'FK';   
  127. $country['Malawi']= 'MW';   
  128. $country['Malaysia']= 'MY';   
  129. $country['Mali']= 'ML';   
  130. $country['Macedonia']= 'MK';   
  131. $country['Marshall Islands']= 'MH';   
  132. $country['Martinique']= 'MQ';   
  133. $country['Mayotte']= 'YT';   
  134. $country['Mauritius']= 'MU';   
  135. $country['Mauritania']= 'MR';   
  136. $country['United States']= 'US';   
  137. $country['American Samoa']= 'AS';   
  138. $country['United States miscella-neous Pac']= 'UM';   
  139. $country['United States Virgin Is-lands']= 'VI';   
  140. $country['Mongolia']= 'MN';   
  141. $country['Montserrat']= 'MS';   
  142. $country['Bangladesh']= 'BD';   
  143. $country['Peru']= 'PE';   
  144. $country['Micronesia']= 'FM';   
  145. $country['Myanmar']= 'MM';   
  146. $country['Moldova']= 'MD';   
  147. $country['Morocco']= 'MA';   
  148. $country['Monaco']= 'MC';   
  149. $country['Mozambique']= 'MZ';   
  150. $country['Mexico']= 'MX';   
  151. $country['Namibia']= 'NA';   
  152. $country['South Africa']= 'ZA';   
  153. $country['Antarctica']= 'AQ';   
  154. $country['South Georgia and South Sandwich Islands']= 'GS';   
  155. $country['Yugoslavia']= 'YU';   
  156. $country['Nauru']= 'NR';   
  157. $country['Nepal']= 'NP';   
  158. $country['Nicaragua']= 'NI';   
  159. $country['Niger']= 'NE';   
  160. $country['Nigeria']= 'NG';   
  161. $country['Niue']= 'NU';   
  162. $country['Norway']= 'NO';   
  163. $country['Norfolk Island']= 'NF';   
  164. $country['Pitcairn Islands Group']= 'PN';   
  165. $country['Portugal']= 'PT';   
  166. $country['Japan']= 'JP';   
  167. $country['Sweden']= 'SE';   
  168. $country['Switzerland']= 'CH';   
  169. $country['El Salvador']= 'SV';   
  170. $country['Sierra leone']= 'SL';   
  171. $country['Senegal']= 'SN';   
  172. $country['Cyprus']= 'CY';   
  173. $country['Seychells']= 'SC';   
  174. $country['Saudi Arabia']= 'SA';   
  175. $country['Christmas Island']= 'CS';   
  176. $country['Sao Tome and Principe']= 'St';   
  177. $country['Saint helena']= 'Sh';   
  178. $country['Saint Kitts and nevis']= 'KN';   
  179. $country['Saint lucia']= 'LC';   
  180. $country['San Marion']= 'SM';   
  181. $country['Saint Pierre and Miquelon']= 'PM';   
  182. $country['Saint Vincent and the Grenadines']= 'VC';   
  183. $country['Sri Lanka']= 'LK';   
  184. $country['Slovakia']= 'SK';   
  185. $country['Slovenia']= 'SI';   
  186. $country['Svalbard and jan Mayen Islands']= 'SJ';   
  187. $country['Swaziland']= 'SZ';   
  188. $country['Sudan']= 'SD';   
  189. $country['Suriname']= 'SR';   
  190. $country['Somalia']= 'SO';   
  191. $country['Solomon Islands']= 'SB';   
  192. $country['Tajikistan']= 'TJ';   
  193. $country['Thailand']= 'TH';   
  194. $country['Tanzania']= 'TZ';   
  195. $country['Tonga']= 'TO';   
  196. $country['Turks and Caicos Islands']= 'TC';   
  197. $country['Trinidad and Tobago']= 'TT';   
  198. $country['Tunisia']= 'TN';   
  199. $country['Tuvalu']= 'TV';   
  200. $country['Turkey']= 'TR';   
  201. $country['Turkmenistan']= 'TM';   
  202. $country['Tokelau']= 'TK';   
  203. $country['Wallis and Futuna Is-lands']= 'WF';   
  204. $country['Vanuatu']= 'VU';   
  205. $country['Guatemala']= 'GT';   
  206. $country['Venezuela']= 'VE';   
  207. $country['Brunei Darussalam']= 'BN';   
  208. $country['Uganda']= 'UG';   
  209. $country['Ukraine']= 'UA';   
  210. $country['Uruguay']= 'UY';   
  211. $country['Uzbekistan']= 'UZ';   
  212. $country['Spain']= 'ES';   
  213. $country['Western Sahara']= 'EH';   
  214. $country['Western Samoa']= 'WS';   
  215. $country['Greece']= 'GR';   
  216. $country['Hong Kong']= 'HK';   
  217. $country['Singapore']= 'SG';   
  218. $country['New Caledonia']= 'NC';   
  219. $country['New Zealand']= 'NZ';   
  220. $country['Hungary']= 'HU';   
  221. $country['Syria']= 'SY';   
  222. $country['Jamaica']= 'JM';   
  223. $country['Armenia']= 'AM';   
  224. $country['Yemen']= 'YE';   
  225. $country['Iraq']= 'IQ';   
  226. $country['Iran']= 'IR';   
  227. $country['Israel']= 'IL';   
  228. $country['Italy']= 'IT';   
  229. $country['India']= 'IN';   
  230. $country['Indonesia']= 'ID';   
  231. $country['United Kingdom']= 'GB';   
  232. $country['British Virgin Islands']= 'VG';   
  233. $country['British indian Ocean Ter-ritory']= 'IO';   
  234. $country['Jordan']= 'JO';   
  235. $country['Viet Nam']= 'VN';   
  236. $country['Zambia']= 'ZM';   
  237. $country['Zaire']= 'ZR';   
  238. $country['Chad']= 'TD';   
  239. $country['Gibraltar']= 'GI';   
  240. $country['Chile']= 'CL';   
  241. $country['Central Africa']= 'CF';   
  242. $country['China']= 'CN';   
  243. $country['Taiwan,China']= 'CT';   
  244.     }   
  245.   
  246.     return $country[$fullname];   
  247. }   



代码片段:国家代码缩写 结束。
Tag:PHP教程PHP技巧,php培训,php学习,php安装电脑学习 - 编程入门 - PHP教程
代码片段:国家代码缩写相关文章