简体   繁体   English

从 PHP 数组中提取特定数据

[英]Pull specific data from PHP array

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..现在,我只需要提取代码的“ID”部分。

I just tried:我刚试过:

dump($data[7]=>id);die;

Its JSON use this code:它的 JSON 使用以下代码:

$json = json_decode($data[7],true);
dump($json['id']);die;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM