由于 Zend_Rest_Client_Result 对象,我有一个像这样的简单 xml 对象。
<userdetails>
<name value="jake"/>
<type value="user"/>
<attribute name="fname">
<value>Jake</value>
</attribute>
<attribute name="lname">
<value>Gordon</value>
</attribute>
<attribute name="phone">
<value>123-555-1234</value>
<value>999-888-7777</value>
</attribute>
</userdetails>
如何使用 PHP 从上述 XML 对象创建这样的数组?
$userDetails = array();
$userDetails["name"] = "jake";
$userDetails["type"] = "user";
$userDetails["fname"] = "Jake";
$userDetails["lname"] = "Gordon";
$userDetails["phone"][0] = "123-555-1234";
$userDetails["phone"][1] = "123-555-1234";
谢谢,