How can HTML meta refresh be used to reload a page in PHP?
To reload a page in PHP using HTML meta refresh, you can add a meta tag with the "http-equiv" attribute set to "refresh" and the "content" attribute set to the number of seconds after which the page should reload. This will cause the page to automatically refresh after the specified time interval.
<?php
// Set the number of seconds after which the page should reload
$refreshTime = 5;
// Output the HTML meta refresh tag
echo '<meta http-equiv="refresh" content="' . $refreshTime . '">';
?>
Keywords
Related Questions
- How does the configuration of the web server impact the execution of PHP code in non-PHP files?
- What potential security risks are associated with using the mysql_* functions in PHP, and what alternative should be used instead?
- How can PHP developers efficiently handle marking threads as read or unread in a forum application?