How to Refresh a Page Periodically Using PHP
Topic: PHP / MySQLPrev|Next
Answer: Use the
You can simply use the
header() function to automatically refresh a page periodically (i.e. at certain time intervals) using PHP. Please, note that
header() function must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP script.
The following example will refreshes the current page every five seconds.
ExampleTry this code »
<?php header("refresh: 5;"); ?>
Here are some more FAQ related to this topic:
- How to make a redirect in PHP
- How to get current page URL in PHP
- How to get the current date and time in PHP