doulutian4843 2013-11-06 06:57
浏览 14
已采纳

PHP中的电子邮件验证无法正常运行

I added validation on email input, but it is not working, why?

the error is that when I give input as example@yah.oo.com; not showing any error messages, why?

my code is

else if(!filter_var($email,FILTER_VALIDATE_EMAIL))
{
    echo "email is not valid";
    return false;

}

I also used preg_match function but the same problem occurs, can any one tell me why it is not showing any validation message.
As of my knowledge, that an email address only contains one dot(.) is it

  • 写回答

2条回答 默认 最新

  • dongzhuo1930 2013-11-06 07:00
    关注

    The validation is correct - your understanding is wrong. An email address of joe.soap@example.co.uk (two dots) is valid, as is joe.soap@email.example.co.uk (three dots), etc.

    The only reliable way to validate an email address is to send a message to it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 前端echarts坐标轴问题
  • ¥15 CMFCPropertyPage
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题
  • ¥15 谁会P4语言啊,我想请教一下
  • ¥15 这个怎么改成直流激励源给加热电阻提供5a电流呀
  • ¥50 求解vmware的网络模式问题 别拿AI回答