(1).如果要用此方法,在用之前不能有HTML输出。
$url="http://wcily123.iteye.com";
header("Location: $url");
(2).
echo "<script>window.location =\"test.php\";</script>";
或
将window.location换成self.location
(3).
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=index.php\">";
$url="http://wcily123.iteye.com";
header("Location: $url");
(2).
echo "<script>window.location =\"test.php\";</script>";
或
将window.location换成self.location
(3).
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=index.php\">";
本文介绍了三种实现网页重定向的方法:使用PHP的header函数、JavaScript的window.location属性以及HTML的meta标签。这些方法可以帮助开发者根据不同场景选择合适的重定向方式。
296

被折叠的 条评论
为什么被折叠?



