控制php页面跳转的
1 页面跳转在当前页设置刷新
<?if(isset($url)) exit;?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="refresh" content="5;URL=<? echo $url;?>" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
2 重定向跳转.php
<?php
if(isset($url))
{
header("HTTP/1.1 303 see other");
header("location: $url"); exit;
}
?>
3 脚本实现控制跳转
<?php
$url="http://www.csdn.net";
echo "<script language='javascript'>";
echo "location.href='$url'";
echo "</script>";
?>
4 补充方法
cho "< meta http-equiv=\\"Refresh\\" content=\\"秒数; url=跳转的文件或地址\\" > "; 其中:XX是秒数,0为立即跳转.refresh 是刷新的意思.Url 是要跳转到的页面.
5 script实现方式
<script>url="submit.php";window.location.href=url;</script>
6 利用script实现,所不同的是使用 open 语句.且可以限制原窗口还是父窗口,子窗口或者新窗口.
<?php
$url="http://www.csdn.net";
echo "<script>";
echo "window.open('$url',3,'_bank')";
echo "</script>";
?>
<script>url="submit.php";window.open(\'url,\'\',\'_self\');</script>
其中 更改\'_self\' 就可以实现跳转限制原窗口还是父窗口,子窗口或者新窗口
7 利用php自带函数发送头部信息
header("Location: Url");