In PHP, you can use output HTML and JavaScript to jump to the specified address after a three-second pause. Here is some sample code:
In the above code,<meta>tag is used to set HTTP response headers that instruct the browser to jump to the specified URL after three seconds.<p>Markers are used to display a message telling the user what is about to happen. Note that you can changecontentThe value of the property to specify additional wait time (in seconds) and URL.
If you don't want to display the waiting message, you can change<meta>Tags are replaced with JavaScript code, for example:
echo '<html>';
echo '<head>';
echo '<script>setTimeout(function() { window.location.href = "https://www.example.com"; }, 3000);</script>';
echo '</head>';
echo '</html>';In the above code,<script>tag is used to define an anonymous function that usessetTimeoutThe function sets a timer to redirect the browser to the specified URL after three seconds. Note that the time unit used by the timer is in milliseconds, so you need to multiply the wait time by 1000.
Common codes
if(count($u) >= $_GET['n']){
$_GET['n']++;
$url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?n=".$_GET['n'];
echo '<html>';
echo '<head>';
echo '<meta http-equiv="refresh" content="1; url='.$url.'">';
echo '</head>';
echo '<body>';
echo '<p>请等待三秒钟,即将跳转到 <a href="'.$url.'">'.$url.'</a>。</p>';
echo '</body>';
echo '</html>';
}