PHP页面跳转

控制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");  

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值