dongliufa6380 2014-04-17 08:48
浏览 21
已采纳

Luracast Restler - 在一个路由规则中路由一个对象/对象列表

I dont know how to configure routing class to route this in one index method:

categories/176
categories/?depth=3&category=4

first URL is for one category, the second one is for list of categories (filtered by depth and category parameter).

I have class Categories with this method:

/**
* @smart-auto-routing false
*/
public function index($category_id) {
}

OK, this works for categories/176 but how can I add categories/?depth=3&category=4 routing to this index method?

  • 写回答

1条回答 默认 最新

  • doukan4039 2014-04-18 07:34
    关注
    Class Categories
    {
    
        public function index($depth=3, $category=4) {
            //categories?depth=3&category=4 received here
            //since they have default values we can call
            //categories with out any query param too!
        }
    
        public function get($id){
            //categories/176 received here
        }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用