如果要在关联数组中以递增顺序添加数据,可以执行以下操作:
$newdata = array ( 'wpseo_title' => 'test', 'wpseo_desc' => 'test', 'wpseo_metakey' => 'test' );// for recipe$md_array["recipe_type"][] = $newdata;//for cuisine $md_array["cuisine"][] = $newdata;
这将根据最后的索引添加到食谱或美食中。
当您有顺序索引:$ arr [0],$ ar [1]
..时,通常在数组中使用数组推入。不能直接在关联数组中使用它。但是由于您的子数组具有这种索引,您仍然可以像这样使用它
array_push($md_array["cuisine"],$newdata);



