开发者

XML & PHP Simple Question

I need to add in a $person into the area were you add a value into addChild ,So it add's the value fo $person it into my xml file

$person->addChild('first_name', $person);

I know this is wrong but could some one explain why 开发者_Python百科?

Thanks


Second argument of SimpleXMLElement::addChild is only used for string values, like:

<first_name>Oliver</first_name>

If you have subelements in the element, you have to create them without specifying a string value (a subelement created will be returned by addChild), and then populate with attributes, values, and sub-elements of their own.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜