Php 无法访问包含@符号的数组对象

Php 无法访问包含@符号的数组对象,php,web,Php,Web,我有一个数组,在对象中包含@符号。我无法访问那个 实际上,我正在将XML解析为数组 打印\r输出低于 [link] => SimpleXMLElement Object ( [@attributes] => Array ( [type] =>

我有一个数组,在对象中包含@符号。我无法访问那个
实际上,我正在将XML解析为数组
打印\r
输出低于

[link] => SimpleXMLElement Object
                        (
                            [@attributes] => Array
                                (
                                    [type] => text/html
                                    [href] => http://www.livingsocial.com/cities/1964-klang-valley-kuala-lumpur/deals/393950-2-pax-steamboat-set-2-iced-lemon-tea
                                    [rel] => alternate
                                )

                        )


$entry->link->@attributes->href
无法访问

您必须使用该方法从SimpleXMLElement对象获取属性

 $entry->link->attributes();
如果要将href属性作为字符串获取,可以执行以下操作:

$href = $entry->link->attributes()->href->__toString();

试试$entry->link->{'@attributes'}这是不正确的语法,xml元素的属性不能有@sign