所以我想從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