您的位置:首页 > 编程语言 > PHP开发

警告:Warning: Cannot modify header information - headers already sent by (output started at E:\phpweb\

2016-04-05 09:29 771 查看
php页面出现错误:Warning: Cannot modify header information - headers already sent
by (output started at E:\phpweb\message\login.php:12) in E:\phpweb\message\login.php on line 46

最直接的办法是:用输出缓存来解决ob_start();

<?php ob_start(); ?>

... HTML codes ...

<?php

... php codes ...

Header("Location: ...");

ob_end_flush();

?>

1在页面顶部的php标签中加入ob_start();

2在返回的信息下面加入ob_end_flush();

也可以把header换成javascript的方式实现跳转
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: