Warning: Cannot modify header information

This question already has an answer here:

  • How to fix “Headers already sent” error in PHP 11 answers
  • Reference - What does this error mean in PHP? 30 answers

  • The error message is triggering because of the HTML that appears before your first <?php tag. You cannot output anything before header() is called. To fix this error start your document with the <?php tag and only start outputting HTML after you are done handling the condition that outputs XML for flash.

    A cleaner solution would be to separate out the XML generation for flash and the HTML output into different files.


    The error message means that the php script has already sent output to the browser before calling the header() function or anything else that requires modifying the http headers.

    it is really hard to try and diagnose where the problem is occuring without see the script properly formatted, but this line:

    header("Content-Type: text/plain");
    

    should be at the start of the script in php tags.


    Seems that you're trying to use a Flash MP3 Player, but you're mixing up some things.

    You're generating the XML playlist file on the same file that you have the player, you could do it, but I think that will be clearer and simpler to have lets say, a genPlayList.php file that will generate the XML file for you.

    Then in your MP3 Player page you can have only a reference to that script:

    ....
    so.addVariable("playlistPath","genPlayList.php");
    ....
    
    链接地址: http://www.djcxy.com/p/69402.html

    上一篇: 字符串不能解析为XML

    下一篇: 警告:不能修改标题信息