Home > Backend Development > PHP Tutorial > PHP生成XML如何换行

PHP生成XML如何换行

WBOY
Release: 2016-06-13 13:23:19
Original
1090 people have browsed it

PHP生成XML怎么换行?
foreach ($data as $k) {
$add = $dom->createElement('add');
$add=$root->appendChild($add); 
$name = $dom->createAttribute("name"); 
$name=$add->appendChild($name);
$nameValue = $dom->createTextNode($k[0]);
$name->appendChild($nameValue);

$drivers=$dom->createAttribute("providerName");
$drivers=$add->appendChild($drivers);
$driversvalue=$dom->createTextNode($k[1]);
$drivers->appendChild($driversvalue);

$connectionstring="Data Source=".$k[2].";Initial Catalog=".$k[3].";Persist Security Info=True;User ID=".$k[4].";Password=".$k[5].";MAX Pool Size=2000;Min Pool Size=3;Connection Lifetime=30;Pooling=true;charset=utf8;";
$connstring=$dom->createAttribute("connectionString");
$connstring=$add->appendChild($connstring);
$connstringvalue=$dom->createTextNode($connectionstring);
$connstring->appendChild($connstringvalue);
}
$output = $dom->saveXML();
echo "

".$output."";
}
PHP生成的XML在页面上显示不换行,怎么让它换行呢?

页面显示结果如下:
 
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template