Lưu this code như cc.php
include_once 'cc.php';
$iso_code = array_search(strtolower($country_that_you_want_to_convert), array_map('strtolower', $countrycodes)); ## easy version
hay chúng ta có thể thực hiện chức năng như thế này:
Version 1:
include_once 'cc.php';
function get_iso_code($country_that_you_want_to_convert, $countrycodes){
$iso_code = array_search(strtolower($country_that_you_want_to_convert), array_map('strtolower', $countrycodes)); ## easy version
return $iso_code;
}
Version 2:
function get_iso_code($country_that_you_want_to_convert){
include_once 'cc.php';
$iso_code = array_search(strtolower($country_that_you_want_to_convert), array_map('strtolower', $countrycodes)); ## easy version
return $iso_code;
}
Xin lỗi nếu tôi đã sai lầm. nếu có chỉ downvote tôi sẽ hạnh phúc để loại bỏ bài viết của tôi. hy vọng nó giúp ai đó.
Nguồn
2016-12-28 22:54:53
Chỉ cần tải xuống danh sách [ISO 3116] (http://www.iso.org/iso/country_codes/iso_3166_code_lists.htm) và thực hiện tra cứu đơn giản ... – ircmaxell