0
我有一個數組名稱$ json_output。從多維數組中刪除密鑰
array(3) {
["ProductsSummary"]=>
array(2) {
["TotalPages"]=>
int(2)
["CurrentPage"]=>
int(1)
}
["Products"]=>
array(60) {
[0]=>
array(3) {
["LastShopUpdate"]=>
string(26) "/Date(1382716320000+0200)/"
["Score"]=>
float(0.2208696)
["ProductId"]=>
int(1306413101)
["ArticleNumber"]=>
}
[1]=>
array(3) {
["LastShopUpdate"]=>
string(26) "/Date(1382716320000+0200)/"
["Score"]=>
float(0.2208696)
["ProductId"]=>
int(1306413101)
["ArticleNumber"]=>
}
等等。我需要從每一箇中取消設置ProductId和LastShopUpdate。
我的嘗試:
<?php
foreach($json_output["Products"] as $bla)
unset($bla['ArticleNumber'], $bla['LastShopUpdate']);
?>
但它無法正常工作。我怎麼能這樣做?
非常感謝!我會接受答案,因爲它是可能的 –
+1簡潔明瞭:) – MackieeE