我使用Symfony2.2和FOSRestBundle
我设置了
#app/config/config/yml
myapp_rest:
resource: "@MyappRestBundle/Resources/config/routing.yml"
type: rest
prefix: /v1和
#src/Myapp/RestBundle/Resources/config/routing.yml
user:
resource: Myapp\RestBundle\Controller\UserController
type: rest我的UserController扩展了FOSRestController,并拥有cgetAction()和newAction()方法。当我尝试路由:debug时,route显示:
。。symfony路由..
get GET ANY /v1/{id}.{_format}
new GET ANY /v1/new.{_format}根据文档,我所期望的是,类似于
"get_users" [GET] /users我遗漏了什么?
发布于 2013-03-25 18:16:54
我建议你读一下路线文档。如果你想使用/users,你必须使用getUsersAction:
公共函数getUsersAction() {} // "get_users“获取/users
否则,请阅读隐式资源名称定义部分。
https://stackoverflow.com/questions/15610571
复制相似问题