1. 程式人生 > >php 代碼設置跳轉

php 代碼設置跳轉

跳轉語句 color win pre url alert code 更改 http

/*
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

php 代碼設置跳轉