1
我面临一些问题,在我的cakephp应用程序中配置Restful路由到自定义插件。根据所执行的休息操作的类型,路线不会被引导至适当的行动。在routes.php文件CakePHP插件的RESTful路由
代码我使用
Router::resourceMap(array(
array('action' => 'index', 'method' => 'GET', 'id' => false),
array('action' => 'view', 'method' => 'GET', 'id' => true),
array('action' => 'add', 'method' => 'POST', 'id' => false),
array('action' => 'edit', 'method' => 'PUT', 'id' => true),
array('action' => 'delete', 'method' => 'DELETE', 'id' => true),
));
Router::mapResources('chronos.chronosApplications'); // chronos is plugin name and chronosApplications is controller in this plugin
请求URL是/克罗诺斯/ chronosApplications/1与请求类型删除。
错误日志
2015-10-20 16:14:23 Error: [MissingActionException] Action ChronosApplicationsController::40() could not be found.
Exception Attributes: array (
'controller' => 'ChronosApplicationsController',
'action' => '40',
)
Request URL: /chronos/chronosApplications/40
Stack Trace:
#0 /usr/share/pear/Cake/Routing/Dispatcher.php(185): Controller->invokeAction(Object(CakeRequest))
#1 /usr/share/pear/Cake/Routing/Dispatcher.php(160): Dispatcher->_invoke(Object(ChronosApplicationsController), Object(CakeRequest), Object(CakeResponse))
#2 /var/www/prime/desman/webroot/index.php(110): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#3 {main}
感谢。
我想实现宁静的路线。如果我使用Router :: connect定义,那么它们将是静态类型的。 –