当前位置: 移动技术网 > IT编程>开发语言>PHP > 网页跳转的多种方式

网页跳转的多种方式

2018年03月01日  | 移动技术网IT编程  | 我要评论

通用

Header函数

 

 header("Location: http://www.guanwei.org"); exit;

header('Refresh:3,Url=other.php');die;

 

Meta标签

 

< meta http-equiv="refresh" content="1;url=http://www.guanwei.org">

 

Js跳转

 

$url = "http://www.guanwei.org";

echo "<script language='javascript' type='text/javascript'>";

echo "window.location.href='$url'";

echo "</script>";

 

 

 

TP中的跳转

成功和失败跳转

 

if($newid){

     //成功

     $this -> success('成功',U(),1);

}else{

     //失败,给本身页面跳转

     $this -> error('添加失败',U(),2);

}

重定向跳转

 

$this -> redirect('Index/index');

redirect方法的参数用法和U函数的用法一致

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网