我有一個數組,字符串和數組具有相同的名稱「item」,一個實例是一個數組,另一個是數組中的字符串,我想刪除整個「item」來自陣列的字符串從數組中刪除字符串項
該陣列;
//JSON
[{
"id":"109",
"text":"dashboard",
"items":[ //to be ignored
{
"id":"1",
"text":"financial_dashboard",
"items":"109" //to be deleted
},
{
"id":"108",
"text":"project_dashboard",
"items":"109" //to be deleted
}
]
}]
//Array PHP
(
[0] => Array
(
[id] => 109
[expanded] => true
[text] => Dashboard
[items] => Array //to be ignored
(
[0] => Array
(
[id] => 1
[expanded] => true
[text] => Financial Dashboard
[items] => 109 //to be deleted
)
[1] => Array
(
[id] => 108
[expanded] => true
[text] => Project Dashboard
[items] => 109 //to be deleted
)
)
))
有什麼建議嗎?
這是一個JSON,對不對? –
你必須知道數組是如何工作的,這個多維數組可以通過刪除來刪除:array [0] [0],array [0] [1] – mohade
'for(i = 0; i
jonzee