检查email地址格式的代码
时间:2007-01-11 来源:mosquito_2006
这是一个完全符合RFC2822和RFC2821的代码。只检查单个email地址。
function check_email_address($email) {
// First, we check that there@#s one @ symbol, and that the lengths are right
if (!ereg("[^@]{1,64}@[^@]{1,255}", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i
相关阅读 更多 +
排行榜 更多 +