结果是这样的<photo><filename>./img/img03.jpg</filename><phototitle>图片3</phototitle></photo>
但是想换行
<photo>
<filename>./img/img14.jpg</filename>
<phototitle>图片14</phototitle>
</photo>
这样要怎么添加代码啊php代码是
$el_id=$message->appendChild(new DOMElement('filename'));
$el_id->appendChild($xmlDoc->createTextNode('./img/img03.jpg'));
但是想换行
<photo>
<filename>./img/img14.jpg</filename>
<phototitle>图片14</phototitle>
</photo>
这样要怎么添加代码啊php代码是
$el_id=$message->appendChild(new DOMElement('filename'));
$el_id->appendChild($xmlDoc->createTextNode('./img/img03.jpg'));
$s =<<< XML
<photo><filename>./img/img03.jpg</filename><phototitle>图片3</phototitle></photo>
XML;echo str_replace('><', '>' . PHP_EOL .'<', $s);<photo>
<filename>./img/img03.jpg</filename>
<phototitle>图片3</phototitle>
</photo>如果你还想要缩进表示,那就太无聊了。恕不奉陪
chr(9) 制表位
chr(10) 换行