0
我有一个Json文件,我需要提取“tempm”我尝试使用不同的形式,但不能永远只得到该值。 1] 1Json数组提取值PHP
$history1 = ("http://link_to_my_api");
echo $history1;
$json_string = file_get_contents($history1);
$parsed_json = json_decode($json_string);
$location = $parsed_json->{'history'}->{'observations'};
var_dump($location[0]);
我认为这将是更好的将其转换为一个数组而不是对象。添加true作为json_decode的第二个参数,这使得它更容易导航。 – Daniel
多数民众赞成它:D谢谢 –
我发布它作为答案,将其标记为接受关闭该问题:) – Daniel