本文介绍了在使用Yii框架时遇到的Controller权限问题。当尝试访问自定义的action时,可能会遇到“You are not authorized to perform this action”的错误。解决方法是在对应的Controller中编辑accessRules,将自定义的action添加到允许访问的列表中。
今天在学习往yii的控制器(Controller)添加action,在web中访问该action的时候出现了一个页面错误,错误提示为“You are not authorized to perform this action.”,原因是没有权限操作这个action,在查看对应Controller的时候发现有一个访问规则(accessRules),通过在accessRules的‘actions’=>中把自定义的action添加进入之后可以正常访问了