It is too much repetitive work to call header()
and then die()
[?] every time a you need to redirect to another URL. That's why you probably have a function / method that looks like the following:
function redirect($url, $http_response_code = 302)
{
header("Location: ".$url, true, $http_response_code);
die;
}
Where does this method live in your projects / frameworks?
It doesn't fit in any category. Wherever I put it, it doesn't feel right. CodeIgniter (and Kohana) put inside of the url
helper class but again, it doesn't feel right (along with methods like site_url()
and base_url()
).