我试图从 foreach 循环创建简单的数组
function ptd_get_taxanomies(){
foreach ($ptd_taxs as $ptd_tax) {
$taxon_arg[] = array(
'taxonomy' =>$ptd_tax->taxonomy,
'field' => 'id',
'terms' => $values
);
}
return $taxon_arg;
}
,但它返回给我多维数组,
Array
(
[0] => Array
(
[taxonomy] => application
[field] => id
[terms] => 8
)
[1] => Array
(
[taxonomy] => dimension
[field] => id
[terms] => 4
)
);
但这不是我想要的,我需要这样的输出 >
array(
'taxonomy' => 'application',
'field' => 'id',
'terms' => '8',
),
array(
'taxonomy' => 'dimension',
'field' => 'id',
'terms' => '4',
)
我如何删除第一级数组并获得如上所示的输出