Jump to content

Ce Reprezinta Aceasta Expresie Din Email Php?


Recommended Posts

Posted

Salut, ce specifica codul acesta ( ce se afala intre '  '  pe prima linie ) ? Este de la un formular de contact.

$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }

Posted

Expresie regulata. Nu le stiu prea bine, dar poti cauta rapid pe google despre regulile expresiilor regulate, daca chiar vrei.

Pe scurt, descrie cum ar trebui sa arate o adresa de email.

love is a verb
Love is a doing word

  • Moderators
Posted

As folosi ceva de genu' pentru validarea adreselor email :).

<?php

$email_1 = 'Courage';
$email_2 = 'courage@pctroubleshooting.ro';

function mail_valid( $email )
{
    return filter_var( $email, FILTER_VALIDATE_EMAIL );
}

if ( ! mail_valid( $email_1 ) ) {
    echo "<p>Adresa {$email_1} este invalida</p>";
} else {
    echo "<p>Adresa {$email_1} este valida</p>";
}

if ( ! mail_valid( $email_2 ) ) {
    echo "<p>Adresa {$email_2} este invalida</p>";   
} else {
    echo "<p>Adresa {$email_2} este valida</p>";
}

?>

Adresa Courage este invalida

Adresa courage@pctroubleshooting.ro este valida

  • Moderators
Posted

Da, filter var este o functie default de la PHP.

http://php.net/manual/en/function.filter-var.php

 

Si ce este scris cu mare este una dintre optiunile care poate primi.

http://php.net/manual/en/filter.filters.validate.php

PHP Developer - Not available for freelancing right now

Daca ai de gand sa postezi la categoria IPB, nu uita sa citesti regulamentul: Link regulament

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.