我有类别控制器,带有索引操作
我需要在输入地址.com/categorie/education
时使用带有参数教育的索引操作.com/categorie/index/education
或将所有操作重定向到索引?
我有类别控制器,带有索引操作
我需要在输入地址.com/categorie/education
时使用带有参数教育的索引操作.com/categorie/index/education
或将所有操作重定向到索引?
你的路线是如何设置的?鉴于缺乏提供的信息,我不得不假设您正在使用 .ini 文件,这就是它的工作方式:
; CATEGORIE
categorie.type = "Zend_Controller_Router_Route_Static"
categorie.route = "categorie"
categorie.defaults.controller = categorie
categorie.defaults.action = index
categorie_view.route = "categorie/:slug"
categorie_view.defaults.controller = category
categorie_view.defaults.action = view
请注意,我确实对其进行了一些更改,因为索引操作 imo 应该列出所有类别。这样,您就有了一个 viewAction 来列出各个类别。
按照您的要求拥有它,我相信它会是这样的:
; CATEGORIE
categorie.route = "categorie/:slug"
categorie.defaults.controller = categorie
categorie.defaults.action = index