Ä¿Ç°×î·ûºÏ¹æ·¶µÄPHP°æEmailµØÖ·ÑéÖ¤´úÂë
Ä¿Ç°×î·ûºÏRFC¹æ·¶µÄPHP°æEmailµØÖ·ÑéÖ¤´úÂ룬×÷ÕßÊÇDouglas Lovell£¬¿ÉÒÔͬʱÑéÖ¤µØÖ·¸ñʽºÍÓòÃûÊÇ·ñÕæʵ£¨ÑéÖ¤ÓòÃû¹¦ÄÜÔÚwindowsƽ̨ÐèÒª5.3°æ±¾¼°ÒÔºó²ÅÄÜÖ§³Ö£©£¬ÔʼµØÖ·³ö×Ô£ºhttp://www.linuxjournal.com/article/9585
function validEmail($email) { $isValid = true; $atIndex = strrpos ( $email, "@" ); if (is_bool ( $atIndex ) && ! $atIndex) { $isValid = false; } else { $domain = substr ( $email, $atIndex + 1 ); $local = substr ( $email, 0, $atIndex ); $localLen = strlen ( $local ); $domainLen = strlen ( $domain ); if ($localLen < 1 || $localLen > 64) { // local part length exceeded $isValid = false; } else if ($domainLen < 1 || $domainLen > 255) { // domain part length exceeded $isValid = false; } else if ($local [0] == '.' || $local [$localLen - 1] == '.') { // local part starts or ends with '.' $isValid = false; } else if (preg_match ( '/\\.\\./', $local )) { // local part has two consecutive dots $isValid = false; } else if (! preg_match ( '/^[A-Za-z0-9\\-\\.]+$/', $domain )) { // character not valid in domain part $isValid = false; } else if (preg_match ( '/\\.\\./', $domain )) { // domain part has two consecutive dots $isValid = false; } else if (! preg_match ( '/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace ( "\\\\", "", $local ) )) { // character not valid in local part unless // local part is quoted if (! preg_match ( '/^"(\\\\"|[^"])+"$/', str_replace ( "\\\\", "", $local ) )) { $isValid = false; } } //5.3.0 This function is now available on Windows platforms. if ($isValid && ! (checkdnsrr ( $domain, "MX" ) || checkdnsrr ( $domain, "A" ))) { // domain not found in DNS $isValid = false; } } return $isValid; }
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ