一、
header()函数
语法:
void header (string string [,bool replace [,int http_response_code]])
举个例子吧:
1、跳转到本地的一个deom.html(立刻跳转,没有任何延迟)
<?php
header("content-type:text/html;charset=utf-8");
header('location:deom.html');
2、跳转到本地的一个deom.html(可以设置延迟时间)
<?php
header("content-type:text/html;charset=utf-8");
header('refresh:10;url=deom.html');
优点:指令简单
缺点:在使用header()函数进行输出时,前面不可以有任何输出(空行、空格也不可以)
二、
javascript()函数(常用、推荐)
举个例子吧:
1、跳转到本地的一个deom.html(立刻跳转,没有任何延迟)
<?php
header("content-type:text/html;charset=utf-8");
<script>
window.location.href='deom.php';
</script>
2、跳转到本地的一个deom.html(可以设置延迟时间,需定时器)
setTimeout—在指定的毫秒数后调用函数或计算表达式
<?php
header("content-type:text/html;charset=urf-8");
<script>
setTimeout("window.location.href='deom.html'",3000);
</script>
分析:指令复杂,但是使用的范围大,局限性小。推荐使用