note 40490 deleted from function.header by nlopess
| From: | nlopess@php.net | Date: | Fri, 05 Mar 2004 18:06:50 +0000 |
| Subject: | note 40490 deleted from function.header by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66316@lists.php.net to get a copy of this message | ||
Note Submitter: www.atypix.com
----
This is a function who can save your time by preserving from two mistakes : "Header already
sent" and "script execution after redirection".
<?php
/**
* redirect()
* http://www.ATYPIX.COM
* http://www.mangeur-de-cigogne.netliberte.com
* @param $url
* @return void
**/
function redirect($url)
{
if(headers_sent())
{
die('Cannot redirect to "'.$url.'" ! Header already sent !');
}else
{
header("Request-URI: $url");
header("Content-Location: $url");
header("Location: $url");
exit;
}
}
?>