|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
temonteiro Smarty n00b
Joined: 09 Jun 2010 Posts: 1
|
Posted: Thu Aug 19, 2010 2:07 pm Post subject: Validação de Email |
|
|
Oi gente,
Vocês conhecem uma maneira de validar um email(verificar se ele foi escrito da maneira correta) usando Smarty? |
|
Back to top |
|
Zeca_JP Smarty n00b
Joined: 23 Oct 2013 Posts: 1
|
Posted: Wed Oct 23, 2013 11:43 am Post subject: e aí.. |
|
|
Bom.....eu uso essa função no php mesmo...nunca tive problema, funciona de boa..
Code: |
/*****************************
VALIDA O EMAIL
*****************************/
function valMail($email){
if(preg_match('/[a-z0-9_\.\-]+@[a-z0-9_\.\-]*[a-z0-9_\.\-]+\.[a-z]{2,4}$/',$email)){
return true;
}else{
return false;
}
}
|
espero ter ajudado..um abraço. |
|
Back to top |
|
migas Smarty Regular
Joined: 07 Apr 2004 Posts: 73 Location: Porto, Portugal
|
Posted: Fri Jun 12, 2015 10:43 am Post subject: |
|
|
A melhor solução é usar o "próprio" php para validar.
http://php.net/manual/en/filter.examples.validation.php
Code: |
<?php
$email_a = 'joe@example.com';
$email_b = 'bogus';
if (filter_var($email_a, FILTER_VALIDATE_EMAIL)) {
echo "This ($email_a) email address is considered valid.";
}
if (filter_var($email_b, FILTER_VALIDATE_EMAIL)) {
echo "This ($email_b) email address is considered valid.";
}
?>
|
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|