本文整理汇总了PHP中UserForm::load方法的典型用法代码示例。如果您正苦于以下问题:PHP UserForm::load方法的具体用法?PHP UserForm::load怎么用?PHP UserForm::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserForm
的用法示例。
在下文中一共展示了UserForm::load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUser
public function actionUser()
{
$model = new UserForm();
if ($model->load(Yii::$app->request->post()) && $model->valideate()) {
} else {
return $this->render('userForm', ['model' => $model]);
}
}
示例2: actionUserForm
public function actionUserForm()
{
$model = new UserForm();
if ($model->load(yii::$app->request->post()) && $model->validate()) {
// alguma coisa
} else {
return $this->render('userForm', array('model' => $model));
}
}
示例3: actionEdit
public function actionEdit()
{
$request = Yii::$app->request;
$user = User::findOne($request->get('id'));
$model = new UserForm();
$model->attributes = $user->attributes;
if ($model->load($request->post()) && $model->validate()) {
//Overall assignment the attributes of $user must be safe attributes
$user->attributes = $model->attributes;
// var_dump($model->attributes);
// var_dump($user->attributes);exit();
if ($user->save()) {
$this->redirect(array('index'));
} else {
}
} else {
if ($model->hasErrors()) {
// foreach($model->getErrors() as $error){
// var_dump($error,false);
// }
}
}
return $this->render('edit', ['model' => $model]);
}