Re: Using HEADER to redirect

From: Date: Thu, 06 Dec 2001 18:40:59 +0000
Subject: Re: Using HEADER to redirect
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-76923@lists.php.net to get a copy of this message
More than likely not. Putting an exit statement after a header redirect is just good practice and ensures that nothing gets executed after redirecting. Mike Don wrote:
Hi, I have a PHP script that uses the following code to redirect to a page of the user's choice: header("Location: http://www.mypage.net/"); In examples of this type of coding in various scriots, the above line is always followed by the statement: exit; I am wondering why. When executing a Header("Location"); statement, does control return to the PHP script after execution? In that case, I assume that the exit; statement is there in order to terminate the php script. In that event, can I execute code within my script after calling the Header("Location") page?


« previous php.general (#76923) next »