php中實作頁面跳轉有幾種方式 ?
php中實作頁面跳躍的方式有:
在PHP腳本程式碼中實作
## 例如
頁面會立即跳轉,因為header執行了location重定向
一、延遲跳躍(例如登陸成功後會有幾秒鐘等待時間,然後跳到了其他頁面)
代碼:
<?php header("Refresh:秒数;url=地址") ?>
<?php header("Refresh:3;url=helloworld.php")?>
<?php sleep(3); header("location:url地址")?>
二、在js腳本程式碼中實作
1.window.location.href方法<script type="text/javascript"> window.location.href="helloworld.php" </script>
<script type="text/javascript"> setTimeout("window.location.href='helloworld.php'",3000);</script>
<script type="text/javascript">window.location.assign("helloworld.php");</script>
<script type="text/javascript"> window.location.replace("helloworld.php");</script>
<script type="text/javascript"> window.open("index.php",_blank,width=300px);</script>
三、使用HTML腳本程式碼完成跳轉
在標籤裡執行程式碼直接插入這句程式碼就可以<meta http-equiv="refresh" content="3;url='helloworld.php'">
PHP影片教學》
以上是php中實現頁面跳轉有幾種方式 ?的詳細內容。更多資訊請關注PHP中文網其他相關文章!