在header(),setcookie()等函数之前不可有内容输出,调整一下

解决方案 »

  1.   

    在header(),setcookie()等函数之前都没有echo等方法的输出,会不会是PHP.ini这个配置文件要配置些什么才可以呢?
      

  2.   

    在cookie的设置语句之前不要有输出语句
      

  3.   

    在文件前加上  ob_start();
      

  4.   

    上面几楼的不都说了吗?
    给你个例子
    <?php
    setcookie("","", );
    ?>
    把这个放在最顶上试试
    setcookie在向浏览器发送请求时,不能有任何数据输出到浏览器
    setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace. If output exists prior to calling this function, setcookie() will fail and return FALSE. If setcookie() successfully runs, it will return TRUE. This does not indicate whether the user accepted the cookie. 
      

  5.   

    呵呵,问题解决了,原来我没有把PHP.ini里的output_buffering这个设置为on啊,谢谢你们啦!