我有一個示例代碼:如何從數組json php中刪除值?
$json_encode = '{"OS":"Android","Title":"Galaxy"}';
$json_decode = json_decode($json_encode);
foreach($json_decode as $key => $value) {
if($key == 'Title') {
unset($key);
}
}
print_r(json_encode($json_decode));
但是結果可以從JSON字符串不remove key='Title'
,如何解決呢?