douxiawei9318 2015-10-14 10:50
浏览 29
已采纳

Symfony2 routing.yml的评论 - 怎么做?

This is the routing in my Symfony2 App (part of routing.yml):

app_my_responses_response:
    path: /author/response/{responseId}/comments/{page}
    defaults: { _controller: AppBundle:Response:view, page: 1 }
    methods: [GET]
    requirements:
        responseId: \d+

Objective of this route – execute on next cases (

  1. /author/response/8293085 { page:1 }
  2. /author/response/8293085/ { page:1 }
  3. /author/response/8293085/comments/ { page:1 }
  4. /author/response/8293085/comments/1/ { page:1 }
  5. /author/response/8293085/comments/2/ { page:2 }

I have problems with urls numbered 1 and 3...and I don't know what to do...

  • 写回答

1条回答 默认 最新

  • duanning9110 2016-06-14 12:11
    关注

    The best way to solve this problem is remove requirements and create another route for 1st and 3th pattern. It works for me. Thanks @kba!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突