Home  >  Article  >  Backend Development  >  How to jump after staying for a few seconds in php

How to jump after staying for a few seconds in php

藏色散人
藏色散人Original
2021-03-18 09:52:042866browse

How to jump after staying for a few seconds in php: 1. Use "header("refresh:5;url=...");" to jump after staying for a few seconds; 2. Use "header("refresh:5;url=...");" setTimeout('myrefresh()',3000);" can be used to stay for a few seconds and then jump.

How to jump after staying for a few seconds in php

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

Stay in php for a few seconds and then jump Statement

Method one:

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

Method two:

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

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to jump after staying for a few seconds in php. 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