添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
酷酷的火龙果  ·  Android ...·  2 月前    · 
拉风的包子  ·  How to solve ...·  5 月前    · 
完美的硬盘  ·  spring - No converter ...·  1 年前    · 
{"value":"23","date":"03/2018"}, {"value":"43","date":"03/2019"}, {"value":"34","date":"12/2017"}, {"value":"13","date":"01/2019"}, {"value":"34","date":"02/2019"}

Now The php Code I am using to fetch the data is as Follows :

$url = "data.json" ;
$ch = curl_init() ;
curl_setopt($ch, CURLOPT_URL, $url) ;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
$result = curl_exec($ch);
curl_close($ch) ;
$data = json_decode($result, true) ;
foreach($data as $mydata)
  $data1 = $mydata["value"] ;
  $data2 = $mydata["date"] ;
echo $data1 ." : ". $data2 ;
echo "<br/>";

I Don't understand what's wrong with the code but it gives an error Warning

Invalid argument supplied for foreach()

This Happens Because the Data is returning NULL Value But I Don't How my JSON Data Format is not correct. THe Format Looks Fine. But it still returns NULL Value.

  • 更多

相关推荐 更多相似问题