Created
May 7, 2013 07:03
-
-
Save hilyjiang/5530740 to your computer and use it in GitHub Desktop.
验证EMAIL是否合法的函数,CodeIgniter Helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 验证邮箱地址是否合法 | |
if ( ! function_exists('verify_email')) | |
{ | |
function verify_email($email) | |
{ | |
$regex = "/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z0-9])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i"; | |
return preg_match($regex, $email) === 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment