我是PHP中這個關聯數組概念的新手。現在我有一個數組命名爲$sample
如下:如何從PHP中的關聯數組中訪問特定的鍵?
Array
(
[name] => definitions
[text] =>
[attributes] => Array
(
[name] => Mediation_Soap_Server_Reporting
[targetnamespace] => https://mediation.moceanmobile.net/soap/reporting
)
[children] => Array
(
[types] => Array
(
[0] => Array
(
[name] => types
[text] =>
[attributes] => Array
(
)
[children] => Array
(
[xsd:schema] => Array
(
[0] => Array
(
[name] => schema
[text] =>
[attributes] => Array
(
[targetnamespace] => https://mediation.moceanmobile.net/soap/reporting
)
[children] => Array
(
[xsd:complextype] => Array
(
[0] => Array
(
[name] => complextype
[text] =>
[attributes] => Array
(
[name] => Mediation_Soap_FaultMessage
)
[children] => Array
(
[xsd:sequence] => Array
(
[0] => Array
(
[name] => sequence
[text] =>
[attributes] => Array
(
)
)
)
)
)
)
)
)
)
)
)
)
)
)
從上面的陣列我想引用(或訪問)鍵XSD:模式。但我無法做到。您能否告訴我應該如何從聯想陣列名稱$sample
訪問或引用此密鑰?提前致謝。
我想你想要:'$ sample ['children'] ['types'] [0] ['children'] ['xsd:schema']'? – Christoph