yii前后台分开登录(第二种方法)的疑问 [ 新手入门 ]
原文地址:http://www.yiichina.com/topic/353 我是原样拿过来的,我现在的问题是:在登录界面登录后仍然停留在登录界面,不能跳转到其它页面;虽然登录成功了,倡是访问其它后台页面,依然会跳转到登录界面。搞不懂是什么原因,我想可能是这个原因吧:
public function beforeControllerAction($controller, $action)
{
if(parent::beforeControllerAction($controller, $action))
{
$route=$controller->id.'/'.$action->id;
if(!$this->allowIp(Yii::app()->request->userHostAddress) && $route!=='default/error')
throw new CHttpException(403,"You are not allowed to access this page.");
$publicPages=array(
'default/login',
'default/error',
);
if(Yii::app()->user->isGuest && !in_array($route,$publicPages))
Yii::app()->user->loginRequired();
else
return true;
}
return false;
}
这段代码搞不懂呀,各位给解释一下吧。
共 7 条回复
-
-
哦 你看一下这篇文章就知道了 http://www.yiichina.com/tutorial/5
-
我要访问后台提示在前台登录,从前台登录了,返回后台就错了
CHttpException(D:\wamp\www\framework\web\auth\CAccessControlFilter.php:170) #0 D:\wamp\www\framework\web\auth\CAccessControlFilter.php(133): CAccessControlFilter->accessDenied(Object(WebUser), '???????????????...') #1 D:\wamp\www\framework\web\filters\CFilter.php(39): CAccessControlFilter->preFilter(Object(CFilterChain)) #2 D:\wamp\www\framework\web\CController.php(1146): CFilter->filter(Object(CFilterChain)) #3 D:\wamp\www\framework\web\filters\CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain)) #4 D:\wamp\www\framework\web\filters\CFilterChain.php(131): CInlineFilter->filter(Object(CFilterChain)) #5 D:\wamp\www\framework\web\CController.php(292): CFilterChain->run() #6 D:\wamp\www\framework\web\CController.php(266): CController->runActionWithFilters(Object(CInlineAction), Array) #7 D:\wamp\www\framework\web\CWebApplication.php(283): CController->run('error') #8 D:\wamp\www\framework\base\CErrorHandler.php(332): CWebApplication->runController('admin/default/e...') #9 D:\wamp\www\framework\base\CErrorHandler.php(205): CErrorHandler->render('error', Array) #10 D:\wamp\www\framework\base\CErrorHandler.php(130): CErrorHandler->handleException(Object(CHttpException)) #11 D:\wamp\www\framework\base\CApplication.php(713): CErrorHandler->handle(Object(CExceptionEvent)) #12 [internal function]: CApplication->handleException(Object(CHttpException)) #13 {main}
sxtuwy 山西
注册时间:2011-07-24
最后登录:2013-06-04
在线时长:0小时0分
最后登录:2013-06-04
在线时长:0小时0分
- 粉丝8
- 金钱1645
- 威望0
- 积分1645