由于项目的需要,需要对中文域名转码(将 Unicode 域名转换为 IDNA ASCII 兼容格式),Google 查到使用 idn_to_ascii
函数可对中文域名(Unicode 域名)转换为 IDNA ASCII 兼容格式
我在 PHP 7.2.1
下运行 echo idn_to_ascii('人民网.中国');
出现了一下错误
[root@izwz9a76txemslg5q0e3zaz ~]# php -v
PHP 7.2.11 (cli) (built: Nov 2 2018 09:15:43) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologie
[root@izwz9a76txemslg5q0e3zaz ~]# php -r "echo idn_to_ascii('人民网.中国');"
PHP Deprecated: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated in Command line code on line 1
Deprecated: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated in Command line code on line 1
- 阅读剩余部分 -