How to refresh page in PHP?

by tressie.damore , in category: PHP General , 2 years ago

How to refresh page in PHP?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers


by darion , 2 years ago

@tressie.damore i believe you can use header() function to send the header to a browser and refresh the page in PHP, code:


// Refresh page in 1 sec
header("refresh: 1;");
by darrion.kuhn , a year ago


In PHP, you can refresh the page using the header() function with the Location header. Here is an example:


In this example, the Refresh header is set to 0 seconds, which means the page will refresh instantly. If you want to specify a delay before the refresh, you can change the value to the desired number of seconds.

Note: The header() function needs to be called before any output is sent to the browser.