我用验证与授权但是登录后还是403无法访问,好像还是规则的问题,但是要怎么弄啊
public function actionIndex() {
$username = @$_POST['username'];
$password = @$_POST['password'];
if (@$username && @$password) {
$identity = new AdminIdentity($username, $password);
if ($identity->authenticate()){
Yii::app()->user->login($identity,3600*24*7);}
else
echo $identity->errorMessage;
}
$this->setPageTitle("关于我们-乐移互动(北京)网络科技有限公司");
$this->render('login');
}
public function actionComment(){
echo 'comment';
}
public function filters()
{
return array(
'accessControl',
);
}
public function accessRules()
{
return array(
array('allow',
'actions'=>array('Comment'),
'roles'=>array('admin'),
),
array('deny',
'actions'=>array('comment'),
'users'=>array('*'),
),
);
}
登录 用户名是 admin,title也是admin
登录是成功的 cookie也写进去了