【问题标题】:symfony 1.4 routing with sf_formatsymfony 1.4 使用 sf_format 路由
【发布时间】:2011-06-06 18:44:50
【问题描述】:

我正在根据these instructions 进行移动检测并将 sf_format 设置为“移动”。

但我无法为移动格式创建单独的路线。是否可以有两条具有相同 url 的路由?以下设置对我不起作用:

mobile_homepage:
  url: /
  param: { module: mobile, action: index, sf_format: html }
  requirements:
    sf_format: mobile

homepage:
  url: /
  param: { module: site, action: index }

mobile_homepage 路由总是匹配的,不管 sf_format。

【问题讨论】:

    标签: routing symfony1


    【解决方案1】:

    当你写作时

      param: { module: mobile, action: index, sf_format: html }
    

    您将此 URL 的“sf_format”设置为“html”。随便写

      param: { module: mobile, action: index }
    

    相反。

    另外,当你使用“需求”时,它应该像这里写的那样使用:

    http://www.symfony-project.org/blog/2008/06/09/how-to-create-an-optimized-version-of-your-website-for-the-iphone-in-symfony-1-1

    【讨论】:

    • 就是这样。即使 sf_format 设置为 'html' 它仍然匹配 mobile_homepage 路由。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多