Re: Header Processing
- From: Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@xxxxxxxxxxxxxxxx>
- Date: Thu, 31 Jul 2008 12:24:49 +0200
Call Me Tom schreef:
Hi Tom,
I was looking at an application with the following code snippet:
ob_start();
session_name('foo');
session_start();
if (!$_SESSION['bar']) { header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php");
ob_end_clean();
exit();
}
I am under the impression that the "header" redirection is immediate.
That is wrong.
This is not like, for example ASP/VB's Response.Redirect.
header() function in PHP does excact what it says and nothing more: Setting a header.
Am I correct or will the 'ob_end_clean()' and 'exit()' actually
process.
They will be processed.
Tom
Bottomline: If you need a 'redirect' via header("Location...") always call exit after that, or the script will merely run on untill it ends.
Regards,
Erwin Moller
--
============================
Erwin Moller
Now dropping all postings from googlegroups.
Why? http://improve-usenet.org/
============================
.
- Follow-Ups:
- Re: Header Processing
- From: Jerry Stuckle
- Re: Header Processing
- References:
- Header Processing
- From: Call Me Tom
- Header Processing
- Prev by Date: Header Processing
- Next by Date: help me in this issue
- Previous by thread: Header Processing
- Next by thread: Re: Header Processing
- Index(es):
Relevant Pages
|