技术栈

CI框架报错 idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated解决办法

PHP

PHP CI框架运行在PHP7.3 idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated 解决办法。

打开文件 libraries/Email.php

修改idn_to_ascii()
增加'IDNA_NONTRANSITIONAL_TO_ASCII,INTL_IDNA_VARIANT_UTS46'

    public function valid_email($email)
    {
        if (function_exists('idn_to_ascii') && $atpos = strpos($email, '@'))
        {
            //$email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos));
            $email = self::substr($email, 0, ++$atpos).idn_to_ascii(self::substr($email, $atpos),IDNA_NONTRANSITIONAL_TO_ASCII,INTL_IDNA_VARIANT_UTS46);
        }

        return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
    }
点我评论
打赏本文
二维码


42

文章

22

标签