Model view controller 从控制器索引中的视图获取参数

Model view controller 从控制器索引中的视图获取参数,model-view-controller,zend-framework,Model View Controller,Zend Framework,我有以下代码: public function indexAction() { $view = $this->_getParam('view'); echo $view; } 这不会打印出我在view/之后输入的任何内容,除非我将index/放在例如/index/view的前面。请注意,当我们查看/questions/3123[任何id都可以]时,stackoverflow的URL中没有“index” 当我必须包含“索引”时,他们怎么会忽略它?我正在使用Zend Fram

我有以下代码:

public function indexAction()
{
    $view = $this->_getParam('view');
    echo $view;
}
这不会打印出我在view/之后输入的任何内容,除非我将index/放在例如/index/view的前面。请注意,当我们查看/questions/3123[任何id都可以]时,stackoverflow的URL中没有“index”


当我必须包含“索引”时,他们怎么会忽略它?我正在使用Zend Framework。

请参阅:

如果您不想遵循通用url结构,其中/controller/action/paramId/paramValue,则需要设置路由。在配置中,您可以放置:

resources.router.routes.question.type = "Zend_Controller_Router_Route"
resources.router.routes.question.route = "question/:id"
resources.router.routes.question.defaults.controller = "question"
resources.router.routes.question.defaults.action = "index"
/question/123的url现在应该映射到question控制器的索引操作,参数id的值为123