php 代码设置跳转

/*
header 跳转:更改页面头部信息,地址跳转,尽量用绝对地址,
js跳转:在php中输出js的跳转语句

*/
//1,后台的php跳转
header('location:'.BASE_URL.'index.php?m=news&c=index&admin=1');
//更改网页头部信息,地址跳转,绝对地址:把路径写全
//header('loaation:index.php');
//相对地址,相对于当前位置的地址,不推荐使用相对地址
//2,js跳转
echo '<script>alert("登录成功");window.location.href="http://localhost/2017/2017/index.php";</script>';
//前台为了效果多用js,后台为了安全和效率,使用header
转载请注明出处: 欢迎留言或qq(1090413588)交流
原文地址:https://www.cnblogs.com/linyusong/p/7266029.html