You are here: Home / Topics / How to refresh a page with PHP

How to refresh a page with PHP

Filed under: PHP on 2023-06-30 06:30:12

Here you will find 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.

<?php 
 echo "Welcome to example.com</br>"; 
 echo "This page will be refreshed every 3 seconds."; 
   
 header("refresh: 3"); 
   
 exit; 
?>


About Author:
V
Vinay Kumar     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.