Home >Backend Development >PHP Tutorial > php中dom生成的xml怎么输出到页面上

php中dom生成的xml怎么输出到页面上

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:32:391196browse

php中dom生成的xml如何输出到页面上
$id= $_GET['id'];
$n = $_GET['n'];
//包含数据库连接文件
include('conn.php');
$dom=new DomDocument('1.0', 'utf-8');
$dom->formatOutput = true;
if($category == ""){
   exit;
};
//  创建根节点
$element = $dom->createElement('element');
$dom->appendchild($element);
$element->setAttribute('n',$n);
$query = mysql_query( "select * from pictures order by LevelID='$id'" );
while( $result = mysql_fetch_array( $query ) )
{
 $t=$dom->createElement('e');
         $t->setAttribute('cr',$result['c']);
         $t->setAttribute('isNew',$result['isNew']);
         $t->setAttribute('fileUrl',$result['fileUrl']);
         $element->appendChild($t);
         print_r($dom->saveXML());
     
}
echo $dom->saveXML();

?> 
我用print和echo都不能把dom输出到页面上,
请问php里dom生成的xml如何能被输出到页面上,谢谢

dom? xml
Statement:
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