**
php杂谈【基础篇】之_14.PHP页面跳转
**
一、用HTTP头信息
1. [size=3]<?php
2. header("Location:[url]http://php.itcast.cn/[/url]");[/size]
上面是302跳转,从seo角度,更喜欢下面的这种301跳转
3. [size=3]<?php
4. header("HTTP/1.1 301 Moved Permanently");
5. header("Location:[url]http://php.itcast.cn/[/url]");[/size]
二、用HTML标记
6. [size=3]<?php if (!isset($url)) exit;?>
7. <html>
8. <head>
9. <meta http-equiv="content-Type" content="text/html; charset=UTF-8" />
10. <meta http-equiv="refresh" content="0; url=<?php echo $url;?>>
11. </head>
12. <body>
13. </body>
14. </html>[/size]
三、用JAVASCRIPT脚本来实现
15. [size=3]<?php
16. $url="http://php.itcast.cn";
17. echo "<script LANGUAGE=’Javascript’>;
18. echo "window.location.href='$url'";
19. echo "</script>";
20. ?>[/size]