<?php
header( "content-type:text/html;charset=utf-8" );
//加载XML文档对象
$xml =simplexml_load_file( 'message.xml' );
//循环读取XML节点,就是对象指向属性的方式
for ( $i = 0 ; $i <count( $xml -> msg ); $i ++){
echo $xml -> msg [ $i ]-> 标题 ;
echo "<br>" ;
echo $xml -> msg [ $i ]-> content ;
echo "<br>" ;
echo $xml -> msg [ $i ]-> addtime ;
echo "<br>" ;
echo $xml -> msg [ $i ]-> reply [ 0 ];
echo "<br>" ;
echo $xml -> msg [ $i ]-> reply [ 1 ];
echo "<br>" ;
}
header( "content-type:text/html;charset=utf-8" );
//加载XML文档对象
$xml =simplexml_load_file( 'message.xml' );
//循环读取XML节点,就是对象指向属性的方式
for ( $i = 0 ; $i <count( $xml -> msg ); $i ++){
echo $xml -> msg [ $i ]-> 标题 ;
echo "<br>" ;
echo $xml -> msg [ $i ]-> content ;
echo "<br>" ;
echo $xml -> msg [ $i ]-> addtime ;
echo "<br>" ;
echo $xml -> msg [ $i ]-> reply [ 0 ];
echo "<br>" ;
echo $xml -> msg [ $i ]-> reply [ 1 ];
echo "<br>" ;
}