【发布时间】:2014-12-14 20:24:21
【问题描述】:
我正在检索一个 xml:
$xml = file_get_contents($query);
echo $xml->Email;
echo $xml[0]->Email;
xml (echo $xml) 如下所示:
<GetUserInfo>
<Customer>TestUser</Customer>
<Email>test@test.com</Balance>
</GetUserInfo>
但这两种方法都会出现以下错误:
Notice: Trying to get property of non-object in test.php on line 86
Notice: Trying to get property of non-object in test.php on line 87
如何获取 Email 和 Customer 的价值?
【问题讨论】: