dongsetan3216
dongsetan3216
2019-01-09 09:01

从PHP数组中提取特定数据

已采纳

I wrote a function wheere I need to store some data in database. I have multidimensional associative array.

I dumped one part of the code..

When I dump:

            $csv->setCode($data[7]);

            dump($data[7]);die;

and I get

"{"id":"131-2-0-615317","o":"raccoon-events-ltd","j":"Member of the...","c":"Sport For All..."}"

Now, I need to pull out just the "ID" part of the code..

I just tried:

dump($data[7]=>id);die;
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dongren4099 dongren4099 2年前

    Its JSON use this code:

    $json = json_decode($data[7],true);
    dump($json['id']);die;
    
    点赞 评论 复制链接分享