How to decode an array of json objects

前端 未结 2 371
无人共我
无人共我 2021-01-13 04:29

I have an array of json objects like so:

[{\"a\":\"b\"},{\"c\":\"d\"},{\"e\":\"f\"}]

What is the best way to turn this into a php array?

2条回答
  •  走了就别回头了
    2021-01-13 04:45

    $array = '[{"a":"b"},{"c":"d"},{"e":"f"}]';
    print_r(json_decode($array, true));
    

    Read the manual - parameters for the json_decode method are clearly defined: http://www.php.net/manual/en/function.json-decode.php

提交回复
热议问题