【发布时间】:2015-01-17 10:46:04
【问题描述】:
我想使用 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 路由?
【问题讨论】:
标签: php rest http cakephp routes