Warning: Cannot modify header information - headers already sent by (output started at E:\wamp\www\index.php:9) in E:\wamp\www\index.php on line 10
错误原因是这个,我程序就一个
<?php
    header('Location: http://baidu.com'); 
?> 
请问哪儿错了?

解决方案 »

  1.   

    header之前不能有echo输出,不能已经有header()或者其他输出语句。
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <?php
    header("location: /abc.php");
    ?>  
    </body>
    </html>这就是我整个程序,我在前面没有输出。
      

  3.   

    一大段代码,那不是输出?放在最开头。header了,最好exit
      

  4.   

    直接这样就可以了,你前面的内容都没啥用
    <?php
    header("location: /abc.php");
    ?> 
      

  5.   


    <?php
    header("location: /abc.php");
    ?>  
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body> 
    </body>
    </html>
    //楼上都说了。我贴下代码