Php 如何在FatFree框架中传递主路由上的参数
我试图实现的是,为所有具有以下URL结构的网站类别提供一条路由:Php 如何在FatFree框架中传递主路由上的参数,php,routes,fat-free-framework,Php,Routes,Fat Free Framework,我试图实现的是,为所有具有以下URL结构的网站类别提供一条路由: mysite.org/FirstCategory mysite.org/SecondCategory mysite.org/ThirdCategory mysite.org/MainCategory/Subcategory-1 mysite.org/MainCategorySubcategory-2 mysite.org/SecondCategory/Subcategory-1 mysite.org/SecondCategory
mysite.org/FirstCategory
mysite.org/SecondCategory
mysite.org/ThirdCategory
mysite.org/MainCategory/Subcategory-1
mysite.org/MainCategorySubcategory-2
mysite.org/SecondCategory/Subcategory-1
mysite.org/SecondCategory/Subcategory-2
此外,我还将具有以下URL结构的动态子类别:
mysite.org/FirstCategory
mysite.org/SecondCategory
mysite.org/ThirdCategory
mysite.org/MainCategory/Subcategory-1
mysite.org/MainCategorySubcategory-2
mysite.org/SecondCategory/Subcategory-1
mysite.org/SecondCategory/Subcategory-2
我的问题是如何设置控制器和路线?在熟悉了无脂文档之后,我仍然无法找到这个问题的答案
任何建议或任何阅读材料都会有很大帮助。假设你在mysite.org上有一个登录页,你很可能会有一条类似于下面的路线
GET /=MainController->render
然后,您可以在该登录页上设置菜单项,以调用不同的网站类别和子类别。示例菜单项可以如下所示
`<li><a href="{{ @BASE . '/main/cat2/subcat0'}}"><i class=""></i> SecondCategory</a></li>`
`<li><a href="{{ @BASE . '/main/cat2/subcat1'}}"><i class=""></i> Subcategory-1</a></li>`
然后,您可以在控制器中选择这些参数并返回所需的内容
$cat_id = $f3->get('PARAMS.cat_id')
$subcat_id = $f3->get('PARAMS.subcat_id')
我会试试的,谢谢你的回答,非常感谢