我想使用CakePHP定义自定义REST路由。我可以创建post/user/:id
的路线。以下是我routes.php
中的相关代码:
Router::connect(
"/pool/user/:id",
array(
'[method]' => 'DELETE',
'controller' => 'user',
'action' => 'delete',
)
);
现在我想创建一条路由为post/:id/user/:id
,其中第一个id
是帖子ID,第二个id
是用户ID。但是当我这样做时它给了我一个错误:
preg_match(): Compilation failed: two named subpatterns have the same name at offset 39 [CORE/Cake/Routing/Route/CakeRoute.php, line 195]
如何创建所需的REST路由?