Home >Backend Development >PHP Tutorial >PHP解析XML问题,
客户端传给我一个xml的串,
$result = simplexml_load_string($simple);
var_dump($result);
foreach( $result as $key => $value) {
$attr = $value->attributes();
echo "service:".$attr['service']."
";
echo "hospitalId:".$value->hospitalId."
";
echo "reqChannel:".$value->reqChannel."
";
}
结果是,没办法获取值。
但是在xml文件中再最后加上一个节点,就ok,
有人知道吗?????