如何实现php页面15秒后自动跳转

来源:百度知道 编辑:UC知道 时间:2024/05/31 03:01:23
如何实现a.php 15秒后自动跳转到b.php,希望高手帮帮忙
要详细点的,而且代码加在什么位置怎么加

<meta http-equiv='refresh'content=15;URL='b.php'>
基本的HTML语言就可以做到

代码加在哪里都可以,这是HTML标签。加哪里浏览器都可以识别的

别用php自己的,邪乎了说会占用服务器资源,反正我不用sleep
用js
在a页面上给一个js,比如
<script>
function goTo() {
window.setTimeout("window.location.href='http://www.baidu.com'",1000);
}
goTo();
</script>
至于这个js怎么触发,就看你php要一个什么样的条件跳转了,反正就是类似于
<?php
if(true) {
?>
上面的代码
<?php
}
?>

html的代码就可以实现这个
<meta http-equiv="refresh" content="15;url=http://www.baidu.com">
content 时间秒数 url 跳转的地址

sleep(15);

加到跳转到b.php之前就行了