headers already sent error

This question already has an answer here:

  • How to fix “Headers already sent” error in PHP 11 answers

  • cookies in HTTP will be transferred using the headers. setcookie() therefore is just a wrapper around header() and cannot being used if there were already output in that script.

    I guess that the output is an error message triggered by the mysql_* functions or whitespace|content before the opening <?php tag


    我有类似的问题。原因是你可能在php标签之前有一个空白区域。删除空间,你很好去。


    use ob_start(); after php tag

    $user = mysql_real_escape_string($_POST['login']);

    to

    ob_start();

    $user = mysql_real_escape_string($_POST['login']);

    链接地址: http://www.djcxy.com/p/34692.html

    上一篇: 如何解决PHP中的“Headers already sent”错误

    下一篇: 标题已发送错误