我使用Gii创建了一个模块(教育)。此模块有一个控制器(文章),其中包含三个操作(索引,读取,写入)。
我访问模块是这样的:
http://example.com/index.php/education/article/index (工作正常)
http://example.com/index.php/education/article/read (重定向到 索引行动)
http://example.com/index.php/education/article/write (重定向到 索引行动)
问题是,我只能在文章控制器中访问索引操作。当我尝试访问任何其他操作时,它始终会重定向到索引操作。
我在config / main中有以下条目:
'modules'=>array(
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'password',
'ipFilters'=>array('127.0.0.1','::1'),
),
'education'
),
知道这是什么问题吗?
答案 0 :(得分:0)
访问过滤器可能有问题。您正尝试打开某些操作,但您没有权限,控制器会将您重定向到默认操作
答案 1 :(得分:0)
这个话题对我很有帮助。在我找到这个话题之前。我有这样的错误。它始终重定向到索引操作。特别是,当我创建基于模块的登录时会发生这种情况,我对此一无所知。在我阅读Pavel提示之后,我再次检查main.php并发现我测试了规则并忘记删除它。 这是urlManager规则中的行。
'<controller:\w+>/<action:\w+>/*'=>'<controller>/<action>',