Searching for "Headers"

Q:

How to use HTTP Headers inside PHP? Write the statement through which it can be added?

Answer

HTTP headers can be used in PHP by redirection which is written as:


<?header('Location: https://www.php.net')?>


The headers can be added to HTTP response in PHP using the header(). The response headers are sent before any actual response being sent. The HTTP headers have to be sent before taking the output of any data. The statement above gets included at the top of the script.


 

Report Error

View answer Workspace Report Error Discuss

Subject: PHP