Read Json/Array string in Php

后端 未结 2 588
悲哀的现实
悲哀的现实 2020-12-12 02:06

I have a string which is in valid Json format and it looks like this:

{
    \"message\": \"success\",
    \"result\": {
        \"46620\": {
            \"co         


        
2条回答
  •  悲&欢浪女
    2020-12-12 02:21

    To loop through all the results, something like this should do it:

    $obj = json_decode($str);
    foreach ($obj->result as $result)
    {
        $fa_title = $result->fa_title;
        $en_title = $result->en_title;
    }
    

提交回复
热议问题