Home >Backend Development >PHP Tutorial >PHP解析XML问题,

PHP解析XML问题,

WBOY
WBOYOriginal
2016-06-20 12:44:13913browse

客户端传给我一个xml的串,1,我用下面的方法来解析:
$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,
000110


回复讨论(解决方案)

有人知道吗?????

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