Home > Backend Development > PHP Problem > php waits for a few seconds before jumping

php waits for a few seconds before jumping

angryTom
Release: 2023-02-27 22:02:02
Original
5825 people have browsed it

php waits for a few seconds before jumping

php waits for a few seconds before jumping

1. PHP script controls the jump method, through Rewrite HTTP header information to jump

a) header refresh method:

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

b) header location method:

<?php 
sleep(3);
Header(“location:index.php”);
?>
Copy after login

two , Jump by outputting JavaScript

<?php 
sleep(3);
$url = "http://www.guanwei.org"; 
echo "<script language=&#39;javascript&#39; type=&#39;text/javascript&#39;>"; 
echo "window.location.href=&#39;$url&#39;"; 
echo "</script>"; 
?>
Copy after login
<?php 
$url = "http://www.guanwei.org"; 
echo "<script language=&#39;javascript&#39; type=&#39;text/javascript&#39;>";
echo "setTimeout(\"window.location.href=&#39;$url&#39;\", 3000)";
echo "</script>"; 
?>
Copy after login

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of php waits for a few seconds before jumping. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template