CakePHP
23
public function action2(){
echo "redirecting from action2";
$this->setAction('action1');
}
}
?>
Create a directory
Redirects
at
src/Template
and under that directory create a
View
file called
action1.ctp
. Copy the following code in that file.
src/Template/Redirects/action1.ctp
This is an example of how to redirect within controller.
Execute the above example by visiting the following URL.
http://localhost:85/CakePHP/redirect-controller
Do'stlaringiz bilan baham: