/** * @general access control */ public function init() { $model = new Perm(); $permission = $model->getPerm(Yii::app()->session['rid']); $controller = Yii::app()->getController()->id; if ($permission['perm'] && !preg_match("/{$controller}/", $permission['perm'])) { die('你没有访问权限!'); } }
public function init() { $model = new Perm(); $this->permission = $model->getPerm(Yii::app()->session['rid']); parent::init(); }