开发者

E-mail validation in php? [duplicate]

开发者 https://www.devze.com 2022-12-20 05:03 出处:网络
Thi开发者_JAVA百科s question already has answers here: Closed 12 years ago. Possible Duplicates: PHP email validation function
Thi开发者_JAVA百科s question already has answers here: Closed 12 years ago.

Possible Duplicates:

PHP email validation function

Is there a php library for email address validation?

I have a contact form on my site but I need a e-mail validation and I don't know how to do it.


$email = "someone@example.com";

if(!filter_var($email, FILTER_VALIDATE_EMAIL))
  {
  echo "E-mail is not valid";
  }
else
  {
  echo "E-mail is valid";
  }

This is probably the simplest method. The example I pasted above is from http://www.w3schools.com/php/filter_validate_email.asp and complete documentation on using filter_var is available at http://us2.php.net/manual/en/function.filter-var.php


my old good friend Google have me some interesting links:

http://www.spoono.com/php/tutorials/tutorial.php?id=41

http://www.linuxjournal.com/article/9585

http://www.plus2net.com/php_tutorial/php_email_validation-ajax.php

http://www.devshed.com/c/a/PHP/Email-Address-Verification-with-PHP/1/

0

精彩评论

暂无评论...
验证码 换一张
取 消