我正在为我的网站使用 codeigniter 框架,但是在 form_validation 中我收到错误我在 stackoverflow 中点击了这个链接,但它对我不起作用, 在 5.2.17 中点击了链接:idn_to_ascii()
问题:

codeigniter 库/form_validation.php 中的代码:
public function valid_email($str)
{
if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $str, $matches))
{
$domain = defined('INTL_IDNA_VARIANT_UTS46')
? idn_to_ascii($matches[2], 0, INTL_IDNA_VARIANT_UTS46)
: idn_to_ascii($matches[2]);
if ($domain !== FALSE)
{
$str = $matches[1].'@'.$domain;
}
}
return (bool) filter_var($str, FILTER_VALIDATE_EMAIL);
}