https://github.com/Borales/yii2-phone-input
$("#phone").on("countrychange", function(e, countryData) {
// do something with countryData
});
When the countrychange event fires, countryData
will contain an object with the country data:
{
"name": "United States",
"iso2": "us",
"dialCode": "1",
"priority": 0,
"areaCodes": null
}
参考地址:
https://stackoverflow.com/questions/48446511/getting-country-code-through-form-in-php-intl-tel