【问题标题】:Zend: What is the most common way to create Rest Zend routes?Zend:创建 Rest Zend 路由最常用的方法是什么?
【发布时间】:2011-05-14 10:23:00
【问题描述】:

我使用默认 Zend_Rest_Route 来生成 Rest 路由:

所以我只是将resources.router.routes.rest.type = Zend_Rest_Route 放在 application.ini 中,现在为用户提供了 Rest Routes

GET users
POST users
GET users/:id        
GET users/:id/edit   
PUT users/:id
DELETE users/:id

但是嵌套资源呢?鉴于我需要

users/:user_id/articles
users/:user_id/articles/:id
... etc

有什么方法可以让路由保持 REST'y? 将欣赏任何创建此类嵌套路由的示例

附:我正在使用 ZF 版本 1.10.8

问候,M

【问题讨论】:

  • 喂,你解决了吗?我有同样的问题

标签: zend-framework rest routes nested-routes


【解决方案1】:

我可能会迟到,但我想回答你的问题。

here所述,在application.ini中创建rest route配置可能不起作用。

说到路由配置,您可以使用 Zend_Controller_Router_Route_Regex 来定义路由和相应的映射。参考我的this问题。可能会对你有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-31
    • 1970-01-01
    • 2014-07-19
    • 1970-01-01
    • 2011-09-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多