I have a json print like this;
When i want to get result->26162616->pubdate i am getting error or null.
my code :
$source = file_get_contents("https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&id=26162616&retmode=json&tool=my_tool&email=my_email@example.com");
$source = json_decode($source);
echo $source->result->26162616->pubdate;
i think reason is integer 26162616 value.
how can i fix this?
Turn JSON into an associative array (true in json_decode) and reference as follows:
$source = json_decode($source, true);
echo $source["result"]["26162616"]["pubdate"]; // 2015 Aug
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.