所以我想从HTML表单中获取电子邮件地址。当我在PHP中收到电子邮件如何检查字符串中是否只允许特殊字符(@, _, -, and .
)?例如:电子邮件输入!#[email protected]
PHP只允许@,_, - 和。从输入
$input = !#[email protected];
if(check is only allowed chars in $input string){
//there is only allowed and check is ok
} else {
//there is not only allowed check and do something else
}
为什么不能代替FILTER_VALIDATE_EMAIL? – mario