0

我使用 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'

    ),

知道有什么问题吗?

4

2 回答 2

0

可能是访问过滤器的问题。您正在尝试打开某些操作,但您没有权限并且控制器会将您重定向到默认操作

于 2013-10-22T09:03:22.893 回答
0

This topic really helpful for me. Before I found this topic. I have the same error like this. It's always redirect to index action. Especially, this happen when I create module based login, I have no idea about this. After I read Pavel hint, I check the main.php again and find out that I tested a rules and forgot to delete this. This is the line in urlManager rules.

'<controller:\w+>/<action:\w+>/*'=>'<controller>/<action>',
于 2014-06-01T09:09:06.360 回答