问题
What are some hidden tricks of PHP in putting timeout on the page and redirect it to another page?
回答1:
You can use sleep on the server-side then redirect to another page with header. Or you can send an HTML page with <meta> tag that specifies redirect location and delay time.
Using sleep and header
<?php
sleep(2);
header('Location: http://www.example.com/');
?>
Using <meta> tag
<meta http-equiv="refresh" content="2;url=http://www.example.com/">
来源:https://stackoverflow.com/questions/5878108/how-to-redirect-visitor-to-another-page-after-certain-time-in-php