【发布时间】:2010-04-13 00:23:04
【问题描述】:
我希望设置一个自定义路由,它为 Zend_Application 提供隐式参数名称。本质上,我有一个如下所示的传入 URL:
/StandardSystems/Dell/LatitudeE6500
我希望将其映射到 StandardsystemsController,并且希望将参数 "make" => "Dell" 和 "model" => "LatitudeE6500" 传递给该控制器。
如何使用 Zend_Application 和 Zend_Controller_Router 设置这样的系统?
编辑:我猜我并没有清楚地解释自己——如果品牌和型号不存在,我想将用户重定向到 StandardsystemsController 上的另一个操作。目前,在 application.ini 中使用 Ballsacian1 的答案:
resources.router.routes.StandardSystem.route = "/StandardSystem/:make/:model"
resources.router.routes.StandardSystem.defaults.controller = "StandardSystem"
resources.router.routes.StandardSystem.defaults.action = "system"
resources.router.routes.StandardSystem.defaults.make = ""
resources.router.routes.StandardSystem.defaults.model = ""
resources.router.routes.StandardSystemDefault.route = "/StandardSystem"
resources.router.routes.StandardSystemDefault.defaults.controller = "StandardSystem"
resources.router.routes.StandardSystemDefault.defaults.action = "index"
【问题讨论】:
标签: php model-view-controller zend-framework routing