Getting value from a SimpleXMLElement object

妖精的绣舞 提交于 2019-12-25 04:43:34

问题


I have

$number[0] 

which is a object(SimpleXMLElement) type.

It has just one element.

The element has this pair 0 -- 9

9 is a string I need to have in a variable.


回答1:


If you want to access anything in your SimpleXMLElement, you will have to access it like an object. i.e

$value = $xml->foo->bar->baz;

This is desribed in more detail at the official documentation for SimpleXML



来源:https://stackoverflow.com/questions/8230894/getting-value-from-a-simplexmlelement-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!