Zend framework2 ZF2$this中的重定向问题->;重定向()

Zend framework2 ZF2$this中的重定向问题->;重定向(),zend-framework2,Zend Framework2,我在编辑产品后尝试重定向用户时遇到问题。编辑操作有效,但当我尝试重定向用户时,页面将保持空白,并具有相同的编辑操作url。 希望你能帮助我: 这是我的代码: public function editAction() { $idProducto = (int) $this->params()->fromRoute('id', 0); if (!$idProducto) { return $this->redirect()->toRoute('

我在编辑产品后尝试重定向用户时遇到问题。编辑操作有效,但当我尝试重定向用户时,页面将保持空白,并具有相同的编辑操作url。 希望你能帮助我: 这是我的代码:

public function editAction()
{
    $idProducto = (int) $this->params()->fromRoute('id', 0);
    if (!$idProducto) {
        return $this->redirect()->toRoute('application', array('controller' => 'product', 'action' => 'index'))->setStatusCode(302);
    }

    $product = $this->getProductTable()->getProduct($idProducto);

    $form = new ProductForm("form_product");
    $form->bind($product);

    $request = $this->getRequest();
    if ($request->isPost()) {
        $form->setData($request->getPost());

        if ($form->isValid()) {
            $this->getProductTable()->saveProduct($form->getData());
}
            // Redirect to list of products
            return $this->redirect()->toRoute('application', array('controller' => 'product'));

    }

    $view = new ViewModel(array(
                                'idProducto' => $idProducto,
                                'form' => $form
                   )
                 );
    $this->layout('layout/layoutProduct');
    return $view;
}

请粘贴相关模块的module.config.php。您的控制器的名称是什么?在第一个重定向中,添加setStatusCode。这是不需要的,因为重定向会自动导致302。嗨,这不允许我编辑帖子并放置module.config.php。我认为问题出在我的主机上,因为相同的代码在我的计算机上工作,但我不知道问题出在哪里。我将尝试上载module.config.php,我的控制器名为ProductController