Heim >Backend-Entwicklung >PHP-Tutorial > php中dom生成的xml怎么输出到页面上

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:32:391198Durchsuche

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
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn