页面跳转的方法

方法一:利用phpheader函数完成重新定向的某页;

 header('Location:a.php');

存在的问题,header函数前不应该有输出(output_buffering=Off)。而且也不容易给出提示。

适合快速跳转。

 

方法二,利用javascript

 <script type="text/javascript">

alert('用户想要输出的内容');

document.location.href = 'a.php';

</script>

但是由于javascript 是运行在浏览器端,受浏览器的设置控制,例如如果不允许运行javascirpt则不能跳转。(虽然很少见)

 

 

方法三:

利用 refresh头 控制跳转

 <html>

<head>

<meta http-equiv="refresh" content="3:url=a.php" />

</head>

<body>

用户想要输出的内容

</body>

</html>

原文地址:https://www.cnblogs.com/codelifewangwen/p/3143377.html