自动跳转有很多种方法,这里提供三种:
1.php的方法
header(‘Location:2.php‘); //echo不能在其前面
echo ‘1‘;
2.head头部跳转
echo ‘2‘;
echo ‘<meta http-equiv="refresh" content="10;url=1.php">‘;//这个前面就可以有输出echo
3.js跳转
echo ‘4‘;
echo "<script>location=‘1.php‘;</script>";
echo ‘3‘;
//echo "<script>location.href=‘1.php‘;</script>"; 也行
顺便写个返回上页面的js
if($bool1){
echo "<script>alert(‘自定义转发邮箱修改成功‘)</script>";
$url = $_SERVER[‘HTTP_REFERER‘];
echo "<script>location=‘".$url."‘;</script>";//回到上一个页面重新加载
}else{
echo "<script>alert(‘自定义转发邮箱修改失败‘)</script>";
echo "<script>history.back();</script>"; //回到上一个页面(上页面表单数据会保存)
}
//回到上一页
echo "<script type="text/javascript">history.back();</script>";
//回到上两页
echo "<script type="text/javascript">history.go(-2);</script>";