Refresh a page using PHP

Refresh a page using PHP

You can do it with PHP:


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 JavaScripts window.location.reload().

Refresh a page using PHP

You sure can refresh a page periodically using PHP:

    header(refresh: 3;);

This will refresh the page every three seconds.

Leave a Reply

Your email address will not be published.