CakePHP Controller
This is a baby model of controller of CakePHP.
Redirect
<?php class SampleController extends AppController { public function index(){ //don't use View $this -> autoRender = false; //Redirect $this -> redirect("./other"); // address is same but user is redirected to other //$this->setAction("other") } public function other(){ $this -> autoRender = false; echo "<html><head></head><body>"; echo "<h1>Sample Page</h1>"; echo "<p>This is sample page.</p>"; echo "</body></html>"; } }
Pass values to another page.
URL becomes http://localhost/cake/sample/other/hoge/gege/123
This URL is more beautiful than GET method. I checked this process using firebug. However, there was not any POST nor GET method. It means that CakePHP creates page beforehand, I guess.
<?php <?php //App::uses('AppController', 'Controller'); class SampleController extends AppController { public function index(){ $this -> autoRender = false; $this -> redirect("./other/hoge/gege/123"); } public function other($a, $b, $c){ $this -> autoRender = false; echo $a ."<br />"; echo $b ."<br />"; echo $c; } }