I'm using:
$location = file_get_contents($mapurl);
which responds with json:
{
"results" : [],
"status" : "ZERO_RESULTS"
}
how can I extract a value for a given key ?
I've tried:
$status = $location::get('status');
but this is throwing errors.
Try
$location = json_decode(file_get_contents($mapurl));
$status = $location->status;
file_get_contents
returns a string, you have to call json_decode
convert it to an object then you can access the status property.
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.