PHP string to array

后端 未结 4 822
北荒
北荒 2021-01-25 11:45

I have a string that when I var_dump returns the following

string(20) \"{\\\"key1\\\":\\\"key1_value\",\\\"key2\\\":\\\"key2_value\\\"}\"

How c

4条回答
  •  一整个雨季
    2021-01-25 12:41

    What you have as data looks like valid JSON. You probably can use json_decode with the second parameter to true (to get an associative array) like this:

    $array = json_decode($string, true);
    

提交回复
热议问题