更新时间:2023-01-31 08:34:18
将内容类型设置为XML,以便浏览器将其识别为XML.
Set the content type to be XML, so that the browser will recognise it as XML.
header( "content-type: application/xml; charset=ISO-8859-15" );
在您的代码中将其更改为:
In your code Change it to:
// Set the content type to be XML, so that the browser will recognise it as XML.
header( "content-type: application/xml; charset=ISO-8859-15" );
// "Create" the document.
$doc = new DOMDocument( "1.0", "ISO-8859-15" );
+++我认为您可以做类似的事情
+++I think you can do something like this
<root>
<?
foreach ( $row as $fieldname => $fieldvalue){
?>
<events>
<fieldname><?=fieldname; ?></fieldname>
<fieldvalue><?=$fieldvalue; ?></fieldvalue>
</events>
}
?>
</root>