没有xml头!
要告诉浏览器,你输出的是xml才成.  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
  header("Cache-Control: no-store, no-cache, must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0", false);
  header("Pragma: no-cache");
 header("Content-type: application/xml");
  echo '<?xml version="1.0" encoding="gb2312" ?>';
  //echo xml串

解决方案 »

  1.   

    Warning: Cannot modify header information - headers already sent by (output started at D:\wwwroot\yurilin\wwwroot\test\php\index.php:1) in D:\wwwroot\yurilin\wwwroot\test\php\index.php on line 22Warning: Cannot modify header information - headers already sent by (output started at D:\wwwroot\yurilin\wwwroot\test\php\index.php:1) in D:\wwwroot\yurilin\wwwroot\test\php\index.php on line 23Warning: Cannot modify header information - headers already sent by (output started at D:\wwwroot\yurilin\wwwroot\test\php\index.php:1) in D:\wwwroot\yurilin\wwwroot\test\php\index.php on line 24Warning: Cannot modify header information - headers already sent by (output started at D:\wwwroot\yurilin\wwwroot\test\php\index.php:1) in D:\wwwroot\yurilin\wwwroot\test\php\index.php on line 25Warning: Cannot modify header information - headers already sent by (output started at D:\wwwroot\yurilin\wwwroot\test\php\index.php:1) in D:\wwwroot\yurilin\wwwroot\test\php\index.php on line 26Fatal error: Call to undefined function  header() in D:\wwwroot\yurilin\wwwroot\test\php\index.php on line 27
      

  2.   

    LS 大大写的我加在
    $result = mysql_db_query("sq_yurilin","select * from book1 limit ".$firstid.",".$lastid);  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
      header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
      header("Cache-Control: no-store, no-cache, must-revalidate");
      header("Cache-Control: post-check=0, pre-check=0", false);
      header("Pragma: no-cache");
     header("Content-type: application/xml");
      echo '<?xml version="1.0" encoding="gb2312" ?>';
    $xml = "";
    因为以前也试验过很多次。不能加head
    如果只是
    echo '<?xml version="1.0" encoding="gb2312" ?>'
    也出错
      

  3.   

    header这个语句最好要放在文件顶部,要不就一定要在没有输出之前(如echo语句等等),否则头标都输出了,就晚了。
      

  4.   

    还有如果你的PHP文件编码是UTF-8的,还要确定你的PHP文件有没有BOM,有则除掉它,一般都是看不到的,楼主可以试一下用EditPlus或Dreamweaver储存那个PHP文件就没有那个BOM,有BOM,PHP会误认为是输出,所以就在header前有了输出。
      

  5.   

    顶部是一样的后果。
    我是用notepad和phpdesigner 2008一起写的。用notepad存的utf-8格式。如何删除bom?
      

  6.   

    Notepad绝对不行,这个是默认的。
      

  7.   

    你可以用其它的编辑软件把代码复制过去,重新保存,phpdesigner 2008不知道可不可以,你试一下把代码复制过去,重新保存(不能复制文件),我只知道EditPlus就绝对可以。Notepad再说一次,是不可以的,这个总是会写BOM,我以前也是这样遇到这个问题的。
      

  8.   

    试过了edit plusFatal error: Call to undefined function  header() in D:\wwwroot\yurilin\wwwroot\test\php\index.php on line 14
      

  9.   

    楼主把修改过的代码贴出来看看,这个错误也真有点奇怪,怎么会提示header是未定义函数呢??
      

  10.   

    加header是为了告诉浏览器,输出的是xml.
    header("Content-type: application/xml");
    这是最关键的一句!
      

  11.   

    随便放哪里都可以。
    现在我暂时解决了。
    就是把头文件的属性去掉就可以读了。不过我是说交互解决了。php的问题依然存在。未定义函数问题,你有兴趣可以自己试验。
    一个表有6列id name qq mail date content。
    表名book1随便加哪里都是这个错。