【发布时间】:2018-10-25 09:41:51
【问题描述】:
从 xml 中读取的数组在 php 数组中的 json 转换有多正确?
<php?
$xmlfile = file_get_contents('data.xml');
$ob= simplexml_load_string($xmlfile);
$json = json_encode($ob);
$configData = json_decode($json, true);
foreach($configData["id"] as $configData)
{
echo $configData["name"];
echo $configData["image"];
echo $configData["id"];
}
?>
警告:在第 10 行的 /data.php 中为 foreach 提供的参数无效
【问题讨论】: