4
使用查询字符串重定向到URL
在我的模块中,执行脚本后,我需要重定向到URL中带有查询字符串的页面。 这是我所拥有的: $redirectUrl = 'http://magento.local/en_en/shop/index'; $redirectArgs = array('test' => '1'); $this->_redirect($redirectUrl, $redirectArgs); 我也尝试过: Mage::app()->getFrontController()->getResponse()->setRedirect($redirectUrl, $redirectArgs)->sendResponse(); 两种方法均会引发错误:处理您的请求时出错 我期望被重定向到 http://magento.local/en_en/shop/index?test=1 有人知道我能做到吗? 编辑: 按照建议,我尝试过: $redirectUrl = 'http://magento.local/en_en/shop/index?test=1'; Mage::app()->getResponse()->setRedirect($redirectUrl); 没有错误,但没有任何反应。我不在控制器中。 编辑2: 我最终使用: $redirectUrl = 'http://magento.local/en_en/shop/index?test=1'; Mage::app()->getResponse()->setRedirect($redirectUrl)->sendResponse(); 这按预期工作!谢谢。