cakephp路由问题,插件路由工作,但不是其他 [英] cakephp routing problem, plugin routing works but not others

查看:135
本文介绍了cakephp路由问题,插件路由工作,但不是其他的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚上传的网站遇到了一个奇怪的路由问题,我进行了一些更改来测试发生了什么。




  • p>我使用一个插件,我已经包括所有路由在routes.php文件。





,它们看起来像这样:

  Router :: connect login',array('plugin'=>'pippoacl','controller'=>'users','action'=>'login')); 

Router :: connect('/ logout',array('plugin'=>'pippoacl','controller'=>'users','action'=>'logout') );

Router :: connect('/ events /',array('controller'=>'events','action'=>'index'

Router :: connect('/ updates',array('controller'=>'updates','action'=>'index'));

当我尝试访问'events'时会出现错误信息: / p>

找不到
错误:在此服务器上找不到请求的地址/ Events。



我已经通过插件的模型/控制器/视图检查了数据库并且可以访问它。



我还确定了事件和更新的模型/控制器。





谢谢,
保罗

解决方案

感谢Sibidiba,



事实证明,这是因为应用程序文件夹中有用户模型和用户控制器以及插件控制器。



立即修复。



干杯,保罗


I'm having a strange routing problem with a site I just uploaded, and I've made a number of changes to test what's happening. It doesn't make any sense.

My setup is:

  • I'm using one plugin, which I've included all the routing in the routes.php file.

  • I've also included the routes for two other controllers, 'events' and 'updates'

they look like this:

Router::connect('/login', array('plugin' => 'pippoacl', 'controller' => 'users', 'action' => 'login'));

Router::connect('/logout', array('plugin' => 'pippoacl', 'controller' => 'users', 'action' => 'logout'));

Router::connect( '/events/', array( 'controller' => 'events', 'action' => 'index'));

Router::connect('/updates', array('controller' => 'updates', 'action' => 'index'));

What happens when I try to get to 'events' is that I get an error message saying:

"Not Found Error: The requested address '/Events' was not found on this server."

I've checked the database and it's accessible, through the plugin's model/controller/view.

I've also made sure the model/controllers for 'events' and 'updates' are there.

Can anyone tell me how to trouble shoot this?

Thanks, Paul

解决方案

Thanks Sibidiba,

As it turns out this happened because there was a user model and user controller in the application folder as well as the plugins controller. So the routing treated other controllers as if they weren't there.

All fixed now.

Cheers, Paul

这篇关于cakephp路由问题,插件路由工作,但不是其他的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆