我的PHP的newbe和我有一些问题,打印一些JSON内容阵列迭代PHP
这是我的代码
//Read text file
$json_data = file_get_contents('data/data.txt');
//Decode it
$obj=json_decode($json_data, true);
//Print array content
print_r($obj);
//Loop the array to write content
foreach($obj as $Item){
// add comment to html list
echo $Item;
}
我的JSON文件
[{"name":"ken"}, {"name":"barbie"}]
我的输出
(
[0] => Array ([name] => ken)
[1] => Array ([name] => barbie)
)
ArrayArray
我该怎么办才能打印“ke n“和”芭比“?
谢谢!
请刚读构成阵列上......怎么把周围还有很多东西对于这个问题,可以帮助你 – Neal
你的问题越来越向下票。请搜索他们,如果你没有找到有用的东西,然后张贴问题。 –