我正在尝试从PHP获得像这样的多维对象数组的响应
[CartItems] => Array
(
[15] => stdClass Object
(
[key] => 15
[value] => stdClass Object
(
[Item] => stdClass Object
(
[id] => 1
[quantity] => 7
)
)
)
[25] => stdClass Object
(
[key] => 25
[value] => stdClass Object
(
[Item] => stdClass Object
(
[id] => 1
[quantity] => 5
)
)
)
[26] => stdClass Object
(
[key] => 26
[value] => stdClass Object
(
[Item] => stdClass Object
(
[id] => 1
[quantity] => 5
)
)
)
)
我在WSDL文件中尝试了一种Array类型
<xsd:complexType name="ArrayOfProducts">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="Product[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
这里的要点是我想使用键直接返回带有可访问元素的数组'CartItems'
我不特别依赖这个解决方案,我只是想直接访问每个对象,而无需遍历所有数组以找到所需的对象。