代码之家  ›  专栏  ›  技术社区  ›  fantactuka

Zend:创建Rest-Zend路由最常用的方法是什么?

  •  5
  • fantactuka  · 技术社区  · 14 年前

    我正在使用默认的Zend_Rest_路由生成Rest路由:

    所以我把 resources.router.routes.rest.type = Zend_Rest_Route 在application.ini中,现在有了供用户使用的Rest路由

    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
    

    有什么办法让路线保持静止吗? 将欣赏创建此类嵌套路由的任何示例

    P.S.我正在使用ZF版本1.10.8

    问候,M

    1 回复  |  直到 14 年前
        1
  •  2
  •   Community CDub    7 年前

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

    如前所述 here ,在application.ini中创建rest路由配置可能无法工作。

    说到路由配置点,您可以使用 Zend_控制器_路由器_路由_Regex 用于定义路由和相应映射。参考 this 我的问题。可能会帮助你。