FatFreeFramework 上的不同路线

问题描述 投票:0回答:1

我有下一条带有自定义变量的路线:

[routes]
GET /category/@item.html = \Controllers\Category\Item->show

它按预期工作,我可以访问下一页:

  • /category/item1.html,
  • /category/item2.html,
  • 等等...

我还有下一页(其中 XYZ 是已知的常数值):

  • /类别/item1XYZ.html,
  • /类别/item2XYZ.html,
  • 等等...

是否可以为此类页面创建单独的路由规则? IE。我想对 item1.html 和 item1XYZ.html 使用不同的控制器。

我想知道路线部分可以这样修改:

[routes]
GET /category/@item.html        = \Controllers\Category\Item->show
GET /category/{{@item}}XYZ.html = \Controllers\Category\ItemXYZ->show

但看起来没有。

php routes fat-free-framework
1个回答
0
投票

单花括号就足够了:

[routes]
GET /category/@item.html        = \Controllers\Category\Item->show
GET /category/{@item}XYZ.html   = \Controllers\Category\ItemXYZ->show
© www.soinside.com 2019 - 2024. All rights reserved.