Added Request::redirect() as a redirect helper

This commit is contained in:
Woody Gilk 2009-06-11 14:23:02 -05:00
parent 117033252f
commit 3438d2a5ef

View file

@ -592,6 +592,28 @@ class Request_Core {
return $this;
}
/**
* Redirects as the request response.
*
* @param string redirect location
* @param integer status code
* @return void
*/
public function redirect($url, $code = 302)
{
// Set the response status
$this->status = $code;
// Set the location header
$this->set_header('location', $url);
// Send headers
$this->send_headers();
// Stop execution
exit(0);
}
/**
* Sends a file as the request response.
*