0

我想处理可能如下所示的 JSON 数据结构:

$json = {"1":"some content here","hello":"world"};

我使用 PHP 中的 json_decode 方法将其转换为数组:

$myArray = (array)json_decode($json);

我现在的问题是

unset($myArray["1"]);

什么都不做。

你能给我什么建议吗?我也试过:

unset($myArray[(String)"1"]);

谢谢!

编辑:我的问题有错误,感谢评论中的更正!

4

1 回答 1

1

我认为您只是访问了错误的数组

unset($myArray["1"]);
unset($myArray[1]); // works also
于 2013-01-13T21:49:25.767 回答