Transfer method works like Redirect method to change page in new location but it can display a message and submit POST value.
App::Config()
[->setPostVars(array("action","complete"))]
->transfer(redirectUrl,[Message])
setPostVars(): setPostVars() method is optional. If we do not define the method then no post value will be submitted.
redirectUrl: Full url path to redirct. If no value is pass then by default baseUrl will set by system.
Message : A string value to display in screen. "System is redirecting control to new location." message will display if no message is set.
See below example:
// Redirect in new location
App::Config()
->setPostVars(
array(
"author_id" => 154
)
)
->transfer("http://www.xyz.com","We are redirecting you in new location.");
// Redirect in new location without post value
App::Config()->transfer("http://www.xyz.com","We are redirecting you in new location.");
// Redirect to home page
App::Config()->transfer();
See Also: Redirect