在CakePHP插件之间导航时出现错误

时间:2012-03-06 13:06:12

标签: php cakephp cakephp-2.0

我在CakePHP插件(我编码的)之间导航时一直出错。

我像这样引导他们:

CakePlugin::loadAll(array(
    'OneTime' => array('bootstrap' => true),
    'Mango' => array('bootstrap' => true),
    'Intercape' => array('bootstrap' => true)
));

我这样链接到他们:

echo $this->Html->link($image,array('plugin'=>'intercape','controller'=>'tickets','action'=>'StepOne','agent'=>FALSE),array('escape'=>FALSE));

echo $this->Html->link($image,array('plugin'=>'mango','controller'=>'tickets','action'=>'StepOne','agent'=>FALSE),array('escape'=>FALSE));

我可以清除缓存并导航到插件,但如果我使用类似下面的链接转到主页,那么下次当我尝试点击其他链接时,我会收到错误。

点击此链接

echo $this->Html->link($image,array('plugin'=>'','controller'=>'agentusers','action'=>'dashboard','agent'=>TRUE), array('escape'=>FALSE));

下次点击 Intercape 链接(不是Mango链接)时会出现此错误

致命错误:第12行的/var/www/mtn/app/Plugin/Mango/Controller/TicketsController.php中找不到“MangoAppController”类

我已经检查过Intercape没有在任何地方引用芒果。清除我的缓存让我单击Intercape并使用该插件,但Mango将无法工作。

1 个答案:

答案 0 :(得分:0)

事实证明,问题在于在不同的插件中使用相同的控制器名称。

Cake正在缓存插件请求中寻找控制器源的位置,因此正在寻找错误的代码。

重命名控制器解决了问题,但使URL有点乱:(