header(\"refresh:5; url=\'pagetoredirect.php\'\");
we can use this if we want to redirect our page in 5 second ,
is there any way to redirect page in 5 second in
Do not use $this->header in controller as it will be removed in 3.0. Use CakeResponse::header().
here is working example for cakephp 2.8
Controller:
$url = array('controller' => 'pages', 'action' => 'index');
$second = '5';
if (!$sessionData) {
return $this->redirect($url);
}
$this->Session->delete($bookingStr);
$this->response->header("refresh:$second; url='" . Router::url($url) . "'");
$this->set(compact('url', 'second'));
View:
Html->link( "You are being redirected to ".Router::url($url, TRUE)." in ".$second." seconds. If you do not wish to wait click here.", $url ); ?>
Thank you.