本文整理匯總了PHP中UserForm::getErrors方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserForm::getErrors方法的具體用法?PHP UserForm::getErrors怎麽用?PHP UserForm::getErrors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserForm
的用法示例。
在下文中一共展示了UserForm::getErrors方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: actionCreateAdmin
/**
* This action enables us to create an admin user for CiiMS
*/
public function actionCreateAdmin()
{
$this->stage = Yii::app()->session['stage'] = 6;
$model = new UserForm();
if (Cii::get($_POST, 'UserForm') != NULL) {
$model->attributes = Cii::get($_POST, 'UserForm', array());
if ($model->save()) {
$this->redirect($this->createUrl('/admin'));
}
$errors = $model->getErrors();
$firstError = array_values($errors);
Yii::app()->user->setFlash('error', Yii::t('Install.main', '{{warning}} {{error}}', array('{{warning}}' => CHtml::tag('strong', array(), Yii::t('Install.main', 'Warning!')), '{{error}}' => $firstError[0][0])));
}
$this->render('createadmin', array('model' => $model));
}
示例2: addAction
public function addAction()
{
$form = new UserForm();
if ($form->isPosted()) {
if ($form->isValidForAdd()) {
$id = User::create(["email" => Input::get("email"), "password" => Hash::make(Input::get("password"))])->id;
$this->defaultGroup($id, 2);
return Redirect::route("user/profile");
}
return Redirect::route("user/add")->withInput(["email" => Input::get("email"), "errors" => $form->getErrors()]);
}
return View::make("user/add", ["form" => $form, "HeaderTitle" => "ADD USER"]);
}