为什么我按照老师那样生成xml缓存文件会报错?
按照老师视频中的教学
public static function xmlApi($code,$message,$data=array()){
if(!is_numeric($code)){
return '';
}
$result=array(
'code'=>$code,
'message'=>$message,
'data'=>$data
);
header("Content-Type:text/xml");
$xml = "<?xml version='1.0' encoding='UTF-8'?>\n";
$xml.= "<root>\n";
$xml.= self::xmlToEncode($result);
$xml.= "</root>";
echo $xml;
}
但是会报错Warning: Cannot modify header information - headers already sent by (output started at D:\web\test\jsonORxml\jsonORxml.php:1) in D:\web\test\jsonORxml\jsonORxml.php on line 89