我查了一下,都说用
header("location:xxx.php");
exit();
但是我用了之后,有个警告信息:
Warning: Cannot modify header information - headers already sent by (output started at H:/php/rijiben/add.php:6) in H:/php/rijiben/add.php on line 66
原来,如果使用 header,那么header之前不能有任何输出,但是这样页面就有点乱了,所以还是用js来实现吧
echo "<script language=javascript>";
echo "document.location.href='read.php'";
echo "</script>";
exit();
个人感觉还是用js比较好
PHP跳转与JS解决方案
本文探讨了在PHP中使用header进行页面跳转时遇到的问题及警告信息的原因,并提供了一种利用JavaScript实现页面跳转的有效替代方案。
109

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



