我有一个带有一些空标签的XML。 xml的一部分在下面
<entity>
<IsDenyingRule>True</IsDenyingRule>
<IsSystemRule>True</IsSystemRule>
<Members>
<item>
<Guid>00000000000000000000000000000008</Guid>
</item>
</Members>
<RelatedAccessPoints></RelatedAccessPoints>
</entity
问题是当我将其转换为对象时,它正在创建一个空数组而不是空对象。
$xmlObject = simplexml_load_string($res->getBody());
[entity] => SimpleXMLElement Object
(
[IsDenyingRule] => True
[IsSystemRule] => True
[Members] => SimpleXMLElement Object
(
[item] => SimpleXMLElement Object
(
[Guid] => 00000000000000000000000000000008
)
)
[RelatedAccessPoints] => SimpleXMLElement Object
(
[0] =>
)
)
如何将“ RelatedAccessPoints”作为空对象而不是空数组对象?