PHP Email Detection Class (with example)

Source: Internet
Author: User
Tags php email
Sharing a PHP implementation of the e-mail detection class, the same is the use of PHP regular, simple and practical, the need to refer to friends.

PHP implementation of the e-mail detection class, to determine the correctness of the email format.

Code:

     success_txt= $success _txt;     $this->error_txt= $error _txt;         } function Start_check ($params) {$this->email= $params;             if (Preg_match ($this->exp, $this->email)) {return $this->echo_result ($this->email,true);             /* Input Email format valid */}else{return $this->echo_result ($this->email,false); /* Invalid email format */}} function Echo_result ($email, $result) {if ($result) {return $e Mail. " [". $this->success_txt."]
"; }else{return "". $email."[". $this->error_txt."]
"; }}}?>

Invocation Example:

 
        [If email format is valid]  [If email format is invalid]  */$a->result_txt ("email format valid", "Invalid email format"); echo $a->start_check ($email _1); echo $a->start_check ($email _2);?>
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.