Skip to content

Commit

Permalink
Added optional HTTP status code parameter to redirect_to (usually you…
Browse files Browse the repository at this point in the history
…'ll want HTTP_SEE_OTHER)
  • Loading branch information
Dylan Verheul authored and Fabrice Luraine committed Mar 11, 2010
1 parent ea858b3 commit 5800b98
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/limonade.php
Expand Up @@ -1896,6 +1896,7 @@ function status($code = 500)
/**
* Http redirection
*
* @param int $http_code HTTP code for redirection
* @param string $params,...
* @return void
*/
Expand All @@ -1911,6 +1912,9 @@ function redirect_to($params)
if(!headers_sent())
{
$params = func_get_args();
if (is_numeric($params[0])) {
status(array_shift($params));
}
$uri = call_user_func_array('url_for', $params);
stop_and_exit(false);
header('Location: '.$uri);
Expand Down

0 comments on commit 5800b98

Please sign in to comment.