Validating Input

More
1 year 6 months ago #8006 by admin
Validating Input was created by admin
$model = new \app\models\ContactForm();

// populate model attributes with user...

Validating Input

As a rule of thumb, you should never trust the data received from end users and should always validate it before putting it to good use.

Given a model populated with user inputs, you can validate the inputs by calling the [[yii\base\Model::validate()]] method. The method will return a boolean value indicating whether the validation succeeded or not. If not, you may get the error messages from the [[yii\base\Model::errors]] property. For example,

Read more...
#AdSense
Google AdSense разместил рекламу по теме: