Zend控制器对一个动作的所有动作

时间:2010-11-08 15:10:58

标签: php model-view-controller zend-framework zend-controller

我有分类控制器,带索引操作

我输入地址.com/categorie/education时需要 它使用带参数教育.com/categorie/index/education

的索引操作

或将所有操作重定向到索引??

1 个答案:

答案 0 :(得分:1)

您的路线如何设置?鉴于缺乏提供的信息,我必须假设您正在使用.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