我尝试了太多东西来从下面的代码中读取[label]的值:
Array ( [0] =>
SimpleXMLElement Object
(
[id] => x
[published] => 2011
[category] =>
Array ( [0] =>
SimpleXMLElement Object
(
[@attributes] =>
Array (
[scheme] => y
[term] => t
) )
[1] => SimpleXMLElement Object
( [@attributes] =>
Array (
[scheme] => y2
[term] => Film
[label] => Film & Animation
) )
它以数字数组开头。
答案 0 :(得分:0)
答案不是那么简单:
$data->category['label']?
下次查看simplexml文档,可以从数组访问所有属性,并且可以通过object属性操作符访问所有子节点。
如果您有多个类别,那么您将在“category [0]”
中拥有一个数组