码迷,mamicode.com
首页 > Web开发 > 详细

网页跳转的多种方式

时间:2018-02-28 16:24:26      阅读:270      评论:0      收藏:0      [点我收藏+]

标签:成功   window   echo   nbsp   a标签   direct   img   www.   dir   

通用

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函数的用法一致

 

网页跳转的多种方式

标签:成功   window   echo   nbsp   a标签   direct   img   www.   dir   

原文地址:https://www.cnblogs.com/jdbeyond/p/8483818.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!