How to Refresh a page after specific time automatically in PHP

Hi, In This tutorial you will know about How to Refresh a page after specific time automatically in PHP. Generally, we did this type of implementation in the javascript or jquery but sometimes javascript is disabled in the user's side (i.e users disabled the javascript in their browsers).

At this situation, we need to implement that code in PHP
it is very simple first we need to fix the specific time for the refresh the website.
In general, the header is used to redirect the web page in PHP by using the location. But here we will use the header in the Refresh tag to set the time and web page URL to refresh the web page.

 //getting the current web page url
 $page = $_SERVER['PHP_SELF'];
 //set the time in seconds
 $sec = "10";
 header("Refresh: $sec; url=$page");
* If you like this post please don't forget to subscribe TechiesBadi - programming blog for more useful stuff


EmoticonEmoticon