What exactly does the Yii email validator check?

This is probably a stupid question, but I could not figure it out. I have the following:

array('email', 'email','message'=>'The email isnยดt correct'), 

What would this verification reliably confirm? That the input contains "@" and "."?

+4
source share
2 answers

The validator uses a regular expression to validate email.

For the specific expression that it uses, see the source . You can then use an online tool like reFiddle to quickly check if the regular expression matches any particular input.

+6
source

Yii is a great basis for validating the form, today I am going to show you how to validate the email field on the form before submitting it. It is very simple, just follow the example below.

if you created the user model with email as one attribute, then add the following code in the rules function.

 public function rules() { return array( ... array('email', 'email','checkMX'=>true), ... ); } 

thats it

+6
source

All Articles