我试图在我的多维数组中做一段时间,如下所示:
$address = array();
while(!$res->EOF)
{
$dataFromDB = array($res->fields['CODCLI'] =>
array(
"Address" => $res->fields['CIDCLI'].",".$res->fields['SIGUFS'].", USA",
"Name" => "SOMENAME")
);
$address[] = $dataFromDB;
$res->MoveNext();
}
结果如下:
Array
(
[0] => Array
(
[28947] => Array
(
[Address] => PIRIPIRI,PI,USA
[Name] => SOMENAME
)
)
)
但我真正需要的是这样:
Array
(
[1] => Array
(
[Address] => PIRIPIRI,PI,USA
[Name] => SOMENAME
)
)
我尝试了其他一些东西,但没有什么可以帮助我,我缺少什么?
答案 0 :(得分:1)
删除第一步,只需执行此操作:
$address[] = array(
"Address" => $res->fields['CIDCLI'].",".$res->fields['SIGUFS'].", USA",
"Name" => "SOMENAME"
);