header() function in PHP?

What is the function of a header() function in PHP?

Answer:
The header() function sends a raw HTTP header to the user.
It is very important to notice that header() must be called before any actual output is seen.

Check the example below

<.html>
// This results in an error as the header should be placed even before the HTML.
// The output above is before the header() call
header('Location: http://www.somesite.com/');
?>

Syntax: header(string,replace,http_response_code)

0 comments:

Post a Comment