How to transform json data to a comma separated php string?

后端 未结 3 471
情歌与酒
情歌与酒 2021-01-20 14:03

Let\'s say i have this json data. How to transform the \"tags\" to a string like

$tags = \"Rihanna, We, Found, Love, (Explicit), Def, Jam, Records, Pop\";

3条回答
  •  春和景丽
    2021-01-20 14:14

    Try:

    foreach($videosList as $i=>$video){
        $videosDatas['videos'][$i]['title'] = $video->title;
        $tags = implode(', ',$video->tags);
        $videosDatas['videos'][$i]['tags'] = $tags;
    }
    

    In place of your code:

    for($i=0; $i

提交回复
热议问题