網頁

2013年3月1日

[php, html, javascript]網頁自動轉址的方法

常見的三種方式。


PHP:
<?php
header("Location: http://blog.nux.tw/");
?>

HTML:
<html><head>
<meta http-equiv="refresh" content="0;url=http://blog.nux.tw/" />
</head></html>
說明:
http-equiv="refresh" 使用頁面刷新方式
content="0;網址" 停留時間(秒),0表示直接刷新。

Javascript:
<script>document.location.href="http://blog.nux.tw/";</script>