Hye there i have a problem Я разрабатываю свой сайт с помощью рамки yii, и теперь, когда пользователь регистрируется, я хочу показать что-то вроде регистрации успешно и перенаправить на страницу входа. К сожалению, он сохраняет перенаправление для входа на страницу, не показывая никаких сообщений. Ниже мой код контроллера пользователяyii setflash не работает при использовании переадресации
public function actionCreate()
{
$model=new User;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['User']))
{
$model->attributes=$_POST['User'];
if($model->save()) {
$this->redirect(array('profile'));
Yii::app()->user->setFlash('success', 'Registration successful. Please login');
}
}
$this->render('create',array(
'model'=>$model,
));
}
Это код для моего журнала в
public function actionProfile()
{
$model=$this->loadModel(Yii::app()->user->id);
unset($model->password);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['User']))
{
$model->attributes=$_POST['User'];
if($model->save())
$this->redirect(array('view','id'=>$model->id));
}
$this->render('update',array(
'model'=>$model,
));
}
Это код для моего правителя доступа
public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('register','create'),
'users'=>array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('profile', 'history', 'recommendation','view'),
'users'=>array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions'=>array('admin','delete','update','create','index'),
'expression' => 'Yii::app()->user->isAdmin()'
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}
Это в моем ActionView
public function actionView($id)
{
$this->render('view',array(
'model'=>$this->loadModel($id),
));
}
Возможный дубликат [yii setflash не работает в php] (http://stackoverflow.com/questions/22434435/yi-setflash-not-working-in-php) – Chalist