How to refresh a page with PHP

In this tutorial, we are going to see how to refresh a page with PHP. You can use header() function to refresh a web page in PHP. HTTP functions are the functions that manipulate the information sent to the client or browser by the web server before sending any other output.

header() function in PHP sends an HTTP header to a client or browser in raw form. Before the HTML, XML, JSON, or any other output has been sent to a browser or client, raw data is sent with the request (especially an HTTP request) issued by the server as a header. The HTTP header provides the required information about the object sent in the message body, specifically the request and response.

How to refresh a page with PHP

This example uses header() function to refresh a web page every 3 seconds.

	echo "Welcome to</br>"; 
	echo "This page will be refreshed every 3 seconds."; 
	header("refresh: 3"); 
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *