2012-08-07 141 views
3

我有magento站點。重定向到magento控制器中的另一個功能

我有一個控制器,我如何重定向到此控制器中的另一個功能?

這意味着,有兩個功能:

1.test() 


i want to redirect from test1() to test2() 

我怎麼能做到這一點?

How can i redirect from one function to another function in the same controller? 

回答

1

你可以把這樣的事情在test1的行動。

$this->_redirect('*/*/test2', array(if you want to pass something then from here you can pass)); 
8

有在前端控制器三種可用的重新定向的函數,它們:

_redirect() 
_redirectUrl() 
_redirectReferer() 

_redirect('frontName/controllerName/actionName/param1/param2')用於內部重定向。
_redirectUrl($fullUrl)用於外部重定向。
_redirectReferer()用於重定向到引用者url。

希望這給了更多的信息。