PHP中實現頁面跳轉有如下幾種方式php
header('location:main.php');
延遲跳轉(好比登錄成功後會有幾秒鐘等待時間,而後跳轉到了其餘頁面)html
header('Refresh:3;url=main.php');
或者瀏覽器
sleep(3); header('location:main.php');
1.window.location.href方法ui
<script> window.location.href = 'main.php'; </script>
使用js方法實現延遲跳轉url
<script> setTimeout("window.location.href = 'main.php'",3000); </script>
2.window.location.assign方法 延遲跳轉方法同上spa
<script> window.location.assign = 'main.php'; </script>
4.window.open方法 三個參數,第一個URL地址。第二個打開新頁面方式(好比新頁面_blank,_new,自身跳轉_self),第三個是新頁面的方式,包括樣式,位置等。code
<script> window.open('main.php','_blank','width=200px'); </script>
(若是被瀏覽器攔截,改成容許便可)htm
在<head>標籤裏執行代碼,直接插入這句代碼就能夠blog
<html> <head> <meta http-equiv="refresh" content="3;url='main.php'"> </head> </html>