简短回答
E.164 是 ITU-T 的国际编号方案。号码以加号开头,后接国家代码和国内号码,最多 15 位,无空格或标点,如 +971501234567。转换本地号码时,去掉长途前缀(通常是 0),加上加号和国家代码,并删除空格和括号。
各国示例
下表中的号码仅为示意用的占位号码。长途前缀取自 ITU 拨号程序表(2011 年 12 月的状态),因此请用 libphonenumber 等库来确认具体国家。
| 国家 | 本地格式(示例) | E.164 |
|---|---|---|
| 阿联酋 | 050 123 4567 | +971501234567 |
| 英国 | 07700 900123 | +447700900123 |
| 意大利(座机) | 06 1234 5678 | +390612345678 |
| 美国 | (202) 555-0123 | +12025550123 |
为什么这对 WhatsApp 和短信很重要
Meta 强烈建议在 WhatsApp 发送请求中包含加号和国家代码。如果没有加号,系统会把发送方的国家代码加到号码前,可能导致消息发给错误的号码。请保存规范的 E.164 号码,并原样发送。
常见错误
- 一律去掉开头的零:ITU 的表格显示意大利、西班牙和卡塔尔没有长途前缀。
- 用正则表达式做验证:它只检查形状,而 libphonenumber 会按国家检查号码是否有效。
- 让 Excel 把电话列当作数字处理,这会去掉开头的零,并把长号码显示为科学计数法。请把该列设为文本格式。
- 以为格式有效就代表号码可以送达。
官方来源
- Recommendation ITU-T E.164: The international public telecommunication numbering plan
- Dialling procedures (international prefix, national (trunk) prefix and national (significant) number), ITU Operational Bulletin No. 994, 15.XII.2011
- WhatsApp user phone number formats — WhatsApp Business Platform, Meta for Developers
- Keeping leading zeros and large numbers — Microsoft Support
- libphonenumber — Google, open-source library on GitHub
