让我解释一下我的问题,我应该在显示联系表单之前调用 Web 服务,Web 服务的返回是:
$items = json_decode('[{"location":[{"building":["Building1"],"name":"Location1"}],"name":"Organization1"},{"location":[{"building":["Building2"],"name":"location2"}],"name":"Organisation2"},{"location":[{"building":["Building3"],"name":"Location3"}],"name":"Organization3"}]');
在这里,我使用以下代码仅提取了组织、位置和建筑物:
foreach( $items as $each ){
echo $each->location[0]->building[0];
echo $each->location[0]->name;
echo $each->name;
}
我想以这种格式获取不同数组中的组织、建筑物和位置的值:
("building1", "building2", "building3")
("organisation1", "organisation2", "organisation3")
("location1", "location2", "location3")