note 75206 deleted from function.header by danbrown
| From: | danbrown@php.net | Date: | Sun, 07 Dec 2008 18:14:25 +0000 |
| Subject: | note 75206 deleted from function.header by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147813@lists.php.net to get a copy of this message | ||
Note Submitter: ludovic.goix-arobas-"google mail"
----
When not using "exit;" after the header("Location: ..."), the execution of the
script continue below the header, until the end is reached. After this, it's doing the
"Redirect".
if($error)
{
header("Location: http://url.com");
}
//the script continue with or without an error and execute some function that we do not want...
delete($file);
It could be important to put exit always after a Redirect.
if($error)
{
header("Location: http://url.com");
exit;
}
//the script continue only without error. It will execute what we want to do.