PHP FILTER_VALIDATE_EMAIL 过滤器
PHP FILTER_VALIDATE_EMAIL 过滤器把值作为 email 地址来验证
- Name: "validate_email"
- ID-number: 274
范例
<?php $email = "someone@exa mple.com"; if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "E-mail is not valid"; }else{ echo "E-mail is valid"; }
运行以上 PHP 范例,输出结果如下
E-mail is not valid