Php 获取以'@';在simplexmlement中
我有一行代码:Php 获取以'@';在simplexmlement中,php,simplexml,Php,Simplexml,我有一行代码: print_r($item->figure->iframe); 这将产生以下输出: SimpleXMLElement Object ( [@attributes] => Array ( [height] => 288 [mozallowfullscreen] => true [src] => http://www.hulu.com/embed.ht
print_r($item->figure->iframe);
这将产生以下输出:
SimpleXMLElement Object
(
[@attributes] => Array
(
[height] => 288
[mozallowfullscreen] => true
[src] => http://www.hulu.com/embed.html?eid=Bq_uuy5X4KWFpYZgwa9e9g
[allowfullscreen] => true
[width] => 512
[frameborder] => 0
[scrolling] => 0
[webkitAllowFullScreen] => true
)
)
然后我试试这个:
var_dump($item->figure->iframe->{'@attributes'}["src"]);
这就给了我:
NULL
我做错了什么?我想得到src
项,为什么我不能得到它
var_dump($item->figure->iframe->attributes());
在未阅读文档的情况下使用类
simplexmlement
,也是错误的。另外