0
我用笨的Web應用程序,我可以從我的數據庫中的數據到一個數組多維數組PHP來選擇2數據
我有這個多維數組
Array
(
[0] => Array
(
[0] => Comerciales
[1] => Array
(
[0] => Terreno
[1] => Galera
[2] => Oficinas
[3] => Locales
[4] => Playas e Islas
[5] => Edificios
[6] => Hoteles
[7] => Propiedades de Inversión/Desarrollo
)
)
[1] => Array
(
[0] => Residenciales
[1] => Array
(
[0] => Array
(
[0] => Ciudad
[1] => Array
(
[0] => Terreno
[1] => Casa
[2] => Apartamento
)
)
[1] => Array
(
[0] => Montaña
[1] => Array
(
[0] => Terreno
[1] => Casa
[2] => Apartamento
)
)
)
)
)
我需要傳遞給一個選擇2數據但是我需要的數據是像thad那樣的聲音,我在php中證明了sone循環,但是我不能讓它工作。請抱歉我的英語。
var theData = [{
"id": "CEN",
"level": "C",
"dataid": "EN",
"text": "England",
"children": [{
"id": "RDEF",
"level": "R",
"dataid": "DEF",
"text": "Default Region",
"children": [{
"id": "D100",
"level": "D",
"dataid": "100",
"text": "Depot 100"
}, {
"id": "D125",
"level": "D",
"dataid": "125",
"text": "Depot 125"
}]
}, {
"id": "RNORTH",
"level": "R",
"dataid": "NORTH",
"text": "North Region",
"children": [{
"id": "D999",
"level": "D",
"dataid": "999",
"text": "Depot 999 - Head Office"
}]
}, {
"id": "RWEST",
"level": "R",
"dataid": "WEST",
"text": "West Region",
"children": [{
"id": "D555",
"level": "D",
"dataid": "555",
"text": "Depot 555"
}]
}]
}, {
"id": "CNL",
"level": "C",
"dataid": "NL",
"text": "Netherlands",
"children": [{
"id": "RNORTH",
"level": "R",
"dataid": "NORTH",
"text": "North Region",
"children": [{
"id": "DNL",
"level": "D",
"dataid": "NL",
"text": "Dutch Depot"
}
]
}]
}]
你嘗試過什麼碼? – anurupr
var tempArray = <?php echo json_encode($ categorias); ?>; alert(tempArray [0] .Key); –
當你運行這個時,你會得到任何錯誤嗎?如果是這樣,你得到的喲錯誤是什麼?如果你能在這裏粘貼它會有幫助嗎? – anurupr