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.

Related Searches:

References

Comments

You May Also Like

  • How to Upload & Resize a PHP MySQL Image

    When dealing with a large amount of images, it is often useful to store them in a database. This makes accessing and...

  • How to Create Web Page Headers

    Web page headers are an important part of all websites--before any content is loaded, the headers convey important information that helps your...

  • How to Read an HTTP Header

    Hypertext Transfer Protocol (HTTP) is a protocol commonly used on the Web. HTTP has several header requests and responses that are used...

  • How to Write a PHP Script Login

    With the use of a MySQL database, you can write a script with the PHP: Hypertext Preprocessor, better known as simply PHP...

  • How to Merge PHP with HTML

    PHP is a handy web programming language that you can use with HTML. You either can add a section of PHP code...

  • How to Hide Email Addresses in PHP

    According to W3Schools, "PHP is a powerful tool for making dynamic and interactive Web pages." PHP: Hypertext Preprocessor is popular because it...

Related Ads

Featured