未找到CakePHP路由URL! [英] CakePHP route URL not found!

查看:168
本文介绍了未找到CakePHP路由URL!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站上做一些自定义路由,但在一个非常愚蠢的问题,已经停留了2天。我有以下路由配置:

I am trying to do some custom routing on my site, but have been stuck for 2 days at a very silly issue. I have the following route configuration:

Router::connect('/your-solution/add-comment/*', array('controller' => 'comments', 'action' => 'add'));
Router::connect('/admin/your-solution/add-comment/*', array('controller' => 'comments', 'action' => 'add', 'admin' => true));

问题是,当我尝试加载使用第二个路由格式化的URL时,错误(404。
第一条规则正常工作。

The problem is that when I try to load a URL formatted using the second route, it gives me a 404 not found. The first rule works fine.

对于这两个规则,我有一个单独的元素,包含一个表单,并指向在相应规则之后格式化的URL。这两个操作的唯一参数是解决方案id,它在通配符中包含。

For both rules I have a separate element containing a form and pointing to a URL formatted after the respective rule. The only parameter for both actions is the solution id, which is "contained" in the wildcard.

可能是什么问题?非常感谢您的帮助!

What could possibly be the issue? Thank you very much for your help!

编辑:

另一个奇怪的行为。当我访问 / admin / your-solution / add-comment / 3 时,它将执行该操作。但是如果我提交一个表单到该链接,它显示一个空白页面,Firebug通知我没有找到该页面。很奇怪...
另外,我有一个类似的路线编辑注释。加载编辑表单和保存表单工作...

I found out another weird behaviour. When I access /admin/your-solution/add-comment/3, it goes to that action. But if I submit a form to that link, it displays a blank page, with Firebug informing me that the page was not found. Very strange... Also, I have a similar route for editing comments. Both loading the edit form and saving the form work...

推荐答案

显然,问题一直在于禁用的输入。在我删除此元素后,表单提交正确,并显示目标页面。

Apparently, the problem has been lying in a disabled input. After I've deleted this element, the form submits correctly and the target page is shown.

为了我的知识,为什么没有提交表单,如果它有一个禁用了输入?

Just for my knowledge, why didn't the form submit if it had a disabled input in it?

这篇关于未找到CakePHP路由URL!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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