Php 无法重定向到自定义模块中magento中的其他页面
我已经创建了用于测试的模块,并尝试从url调用编校操作。所有配置都完成了,一切正常,但是。在我的redme操作中,magento不重定向到其他页面Php 无法重定向到自定义模块中magento中的其他页面,php,magento,zend-framework,http-redirect,Php,Magento,Zend Framework,Http Redirect,我已经创建了用于测试的模块,并尝试从url调用编校操作。所有配置都完成了,一切正常,但是。在我的redme操作中,magento不重定向到其他页面 <?php class Test_Demo_IndexController extends Mage_Core_Controller_Front_Action { public function indexAction() { $this->loadLayout(); $blo
<?php
class Test_Demo_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$block = $this->getLayout()->createBlock('capacityweb/Test','Test',array('template' => 'capacity/web/test.phtml'));
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
public function redmeAction()
{
$this->loadLayout();
$this->renderLayout();
$action=$this->getRequest()->getParam('action');
$id=$this->getRequest()->getParam('id');
if($action!=null && $id!=null)
{
$relContact = Mage::getModel('catalog/product')->getCollection();
}
Mage::app()->getFrontController()->getResponse()->setRedirect("http://google.com");
}
}
但无法重定向。尝试使用以下方法:
$this->_redirectUrl('http://google.com');
而不是
Mage::app()->getFrontController()->getResponse()->setRedirect("http://google.com");
但不能重定向到另一个页面。这样,config.xml中是否需要更改配置?这意味着您的代码中有一些输出。在大多数情况下,这是由于关闭类文件中的php标记(
?>
)并在其后面有空格或新行引起的。
Mage::app()->getFrontController()->getResponse()->setRedirect("http://google.com");