一、用HTTP頭信息
<?php
header("Location:http://php.itcast.cn/");
上面是302跳轉(zhuǎn),從seo角度,更喜歡下面的這種301跳轉(zhuǎn)
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location:http://www.baidu.com/");
二、用HTML標(biāo)記
用HTML標(biāo)記,就是用META的REFRESH標(biāo)記,舉例如下:
<? if (!isset($url)) exit;?>
<html>
<head>
<meta http-equiv="content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="refresh" content="0; url=<? echo $url;?>>
<title> 302調(diào)整_meta </title>
</head>
<body>
</body>
</html>
三、用JAVASCRIPT腳本來(lái)實(shí)現(xiàn)
<?php
$url="http://php.itcast.cn";
echo "<script LANGUAGE=’Javascript’>;
echo "window.location.href='$url'";
echo "</script>";
?>
本文版權(quán)歸傳智播客php培訓(xùn)學(xué)院所有,歡迎轉(zhuǎn)載,轉(zhuǎn)載請(qǐng)注明作者出處。謝謝!
作者:傳智播客php培訓(xùn)學(xué)院