我正在尝试输出有关已解码的json的特定变量的信息那些是标签但是我输出的任何内容都很困难我得到语法错误意外支持var_dump语句后我需要添加/更改所有我感谢所有
$con=mysqli_connect("localhost","root","","json_map");
$response = array();
$res=array();
$json = file_get_contents('C:\Users\Richard\Desktop\test.json');
if($json!=null){
$decoded=json_decode($json,true);
//$decode= var_dump($decoded);
//$ss=$decode["array"];
//echo $decoded['number'];
if(is_array($decoded["configurationItems"]))
{
foreach($decoded["configurationItems"] as $configurationItems)
//for($i=0;$i>sizeof($decoded["configurationItems"]);$i++)
{
var_dump($configurationItems['tags']);
}
}
?>
答案 0 :(得分:2)
在每个
内使用foreach($decoded["configurationItems"] as $configurationItems)
{
var_dump($configurationItems['tags']);
}
OR
var_dump($decoded["configurationItems"]);
答案 1 :(得分:1)
您有以下错误:
;
}
试试这段代码:
if(is_array($decoded["configurationItems"]))
{
foreach($decoded["configurationItems"] as $configurationItems)
{
var_dump($configurationItems['tags']);//Corrected
}//End of foreach
}//End of IF