开发者

what does means symbol "@" in this output?

SimpleXMLElement Object(

 [ImageFormat] => 开发者_如何学JAVASimpleXMLElement Object(

  [@attributes] => Array(

    [DimensionCategory] => small
    [Title] => extra  
  )

  [URL] => link..
 )
)


@attributes is derived from this

<ImageFormat DimensionCategory="small" Title="extra">
  <URL />
</ImageFormat>

in another word, is attributes of a given element

see this


As knittl stated, it's just a member name. As a note: to access attributes in a SimpleXML node, instead of doing:

echo $xml->ImageFormat->{'@attributes'}['Title'];

One would do:

echo $xml->ImageFormat['Title'];


It's simply part of the member name:

echo $xml->ImageFormat->{'@attributes'}['Title'];

You should use the attributes() method of the SimpleXMLElement class to access the attributes of an XML elment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜