Refresh a page using PHP Refresh a page using PHP php php

Refresh a page using PHP


You can do it with PHP:

header("Refresh:0");

It refreshes your current page, and if you need to redirect it to another page, use following:

header("Refresh:0; url=page2.php");


In PHP you can use:

$page = $_SERVER['PHP_SELF'];$sec = "10";header("Refresh: $sec; url=$page");

Or just use JavaScript's window.location.reload().


You sure can refresh a page periodically using PHP:

<?php    header("refresh: 3;");?>

This will refresh the page every three seconds.