Home >Backend Development >PHP Problem >PHP implements a jump statement after staying for a few seconds

PHP implements a jump statement after staying for a few seconds

藏色散人
藏色散人Original
2020-07-14 09:17:262546browse

How to jump after a few seconds in php: 1. Use the "header("refresh:5;url=http://www.XXXXX.com");" method to jump; 2. Through The "setTimeout('myrefresh()',3000);" method implements a jump after 3 seconds.

PHP implements a jump statement after staying for a few seconds

Stay in php for a few seconds and then jump to the statement

Method 1:

<?php
header("refresh:5;url=http://www.XXXXX.com");
print(&#39;正在加载,请稍等...<br>五秒后自动跳转。&#39;);
?>

Method 2:

 <script language="JavaScript">
function myrefresh(){
window.location.href="<?php echo $url_web ?>";
}
setTimeout(&#39;myrefresh()&#39;,3000); //指定3秒转跳
</script>

For more related knowledge, please visit PHP Chinese website!

The above is the detailed content of PHP implements a jump statement after staying for a few seconds. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn