Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use "return;" after a header()?

Tags:

php

Quick question, I noticed that on some of my header directors I was getting some lag while the header processed. Is using return standard after using headers? Also if you use a header on pages you don't want directly accessed, such as processing pages will return; stop that processing even if the page is not directly accessed? IF return is a good idea would it be better to use exit()?

like image 864
Scarface Avatar asked Mar 30 '10 20:03

Scarface


People also ask

What is use of header () function?

The header() method is a built-in function that allows you to deliver a raw HTTP header to a client. HTTP functions allow you to manipulate data supplied to the browser by the webserver before it sends any additional output.

What is the use of header () in PHP?

The header() function sends a raw HTTP header to a client. It is important to notice that the header() function must be called before any actual output is sent!

What is the purpose of header method What is the most important point to execute it properly?

header() function is an inbuilt function that is used to send a raw HTTP header to a client in raw form. Basically, HTTP functions allow you to manipulate information sent to the browser by the webserver before any other output has been sent.

How can I get header in PHP?

The get_headers() function in PHP is used to fetch all the headers sent by the server in the response of an HTTP request. Parameters: This function accepts three parameters as mentioned above and described below: $url: It is a mandatory parameter of type string. It defines the target URL.


1 Answers

header("Location: ......"); exit; is a fairly common pattern.

like image 133
Amber Avatar answered Oct 10 '22 06:10

Amber