How to Close a PHP Header
You can use the PHP header function to send information and commands to the user's web browser. The types of information you can send using the header function include changes to the browser location (causing the browser to redirect to a new page), information on the the content type of the web page and error messages. In order to prevent the PHP header function from continuing to execute code after it is called, you must insert the "exit" command to close the header.
Instructions
-
-
1
Locate the PHP header function, typically located at the top of the PHP document, on the first line. The header function looks like this: "<?php header("[function-code-here]"); ?>"
-
2
Click to place your cursor in front of the "?>" text at the end of the header function. Press "ENTER" to create a new line.
-
-
3
Type "exit;" on the blank line, then press "ENTER" to shift the "?>" text to the next line. The "exit;" command generates a "header("Connection: close");" line when rendered, which closes the PHP header.
-
1