CakePHP嵌套路由具有添加操作

时间:2018-12-12 13:02:54

标签: cakephp routing cakephp-3.0

我正在开发$ISE_EIFFEL/library/runtime/logging/writers/log_writer_system.e应用程序。但是,我遇到了一个我不知道如何解决的问题。

我的CakePHP中有下一条路线:

routes.php

这将导致下一个网址:

http://test.com/teams/76/events/205->在事件控制器中显示视图操作 http://test.com/teams/76/events->在事件控制器中显示索引操作

问题! http://test.com/teams/76/events/add给了我一个错误Router::scope('/', function ($routes) { $routes->resources('Teams', function ($routes) { $routes->resources('Events'); }); }); Router::connect('/teams/:action/*', array('controller' => 'teams'));

我使用The action 76 is not defined in TeamsController!查找了所有路线,发现这些就是我所拥有的路线。

bin/cake routes

即使我尝试使用POST方法重定向到/ teams / 76 / events,也不会重定向| events:index | /teams/:team_id/events | {"controller":"Events","action":"index","_method":"GET","plugin":null} | | events:add | /teams/:team_id/events | {"controller":"Events","action":"add","_method":"POST","plugin":null} | | events:view | /teams/:team_id/events/:id | {"controller":"Events","action":"view","_method":"GET","plugin":null} | | events:edit | /teams/:team_id/events/:id | {"controller":"Events","action":"edit","_method":["PUT","PATCH"],"plugin":null} | | events:delete | /teams/:team_id/events/:id | {"controller":"Events","action":"delete","_method":"DELETE","plugin":null}

感谢您的帮助!

0 个答案:

没有答案