📅  最后修改于: 2023-12-03 15:18:19.926000             🧑  作者: Mango
PHP filter_var_mail 是 PHP 所提供的邮件地址过滤器函数,能够对邮箱地址进行验证和过滤,提高对恶意输入的防护能力。
filter_var($email, FILTER_VALIDATE_EMAIL);
$email
:要过滤的邮件地址。$email = "example@example.com";
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo("$email is a valid email address");
} else {
echo("$email is not a valid email address");
}
```php
$email = "example@example.com";
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo("$email is a valid email address");
} else {
echo("$email is not a valid email address");
}
```