且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

json_decode 到数组

更新时间:2023-12-04 14:37:23

根据文档,您需要如果您想要关联数组而不是 json_decode 中的对象,请指定 true 作为第二个参数.这将是代码:

As per the documentation, you need to specify true as the second argument if you want an associative array instead of an object from json_decode. This would be the code:

$result = json_decode($jsondata, true);

如果你想要 integer 键而不是任何属性名称:

If you want integer keys instead of whatever the property names are:

$result = array_values(json_decode($jsondata, true));

但是,使用您当前的解码,您只需将其作为对象访问:

However, with your current decode you just access it as an object:

print_r($obj->Result);