<?php
$xml = new SimpleXMLElement('<xml/>');
for ($i = 1; $i <= 10; ++$i) {
$invoice = $xml->addChild('invoice');
$invoice->addChild('customer', "客戶名稱");
$invoice->addChild('invoiceNo', "invoiceNo $i");
}
Header('Content-type: text/xml');
print($xml->asXML());
?>
The following error will be shown.
Warning</b>: SimpleXMLElement::asXML(): string is not in UTF-8 in C:\XXXX
The error is caused by the incorrect encoding in the file. You might use your editor to open the file and change the encoding to UTF-8 for the resolution.
