页面跳转的几个小例子

来源:互联网 发布:域名com和cn的区别 编辑:程序博客网 时间:2024/04/29 05:51

页面跳转:

1、header("Location:index.php");(一旦跳转,后面不在执行)

2、<meta http-equiv="refresh" content="2;url=14-10.php">

<head>
<!-- 以下方式只是刷新不跳转到其他页面 -->
<metahttp-equiv="refresh"content="10">
<!-- 以下方式定时转到其他页面 -->
<metahttp-equiv="refresh"content="5;url=hello.html">
</head>

3、echo "<script language='javascript'>alter("wrong!");history.back(-1);</script>";

<script language="javascript"type="text/javascript">

// 以下方式直接跳转
window.location.href='hello.html';
// 以下方式定时跳转
setTimeout("javascript:location.href='hello.html'", 5000);
</script>

4、echo "点击此处<a href="javascript:history.back(-1);">返回</a>";

5、exit('错误:密码长度不符合规定。<a href="javascript:history.back(-1);">返回</a>');