我有下一条带有自定义变量的路线:
[routes]
GET /category/@item.html = \Controllers\Category\Item->show
它按预期工作,我可以访问下一页:
我还有下一页(其中 XYZ 是已知的常数值):
是否可以为此类页面创建单独的路由规则? IE。我想对 item1.html 和 item1XYZ.html 使用不同的控制器。
我想知道路线部分可以这样修改:
[routes]
GET /category/@item.html = \Controllers\Category\Item->show
GET /category/{{@item}}XYZ.html = \Controllers\Category\ItemXYZ->show
但看起来没有。
单花括号就足够了:
[routes]
GET /category/@item.html = \Controllers\Category\Item->show
GET /category/{@item}XYZ.html = \Controllers\Category\ItemXYZ->show