多维数组获取特定键值
for方法,需要知道数组长度,遍历时使用$i
$resultList =$result['projectList'];
$resultNum = count( $resultList);
$arg = array();
for ($i = 0; $i < $resultNum; $i++)
{
$arg['uuid'] = $uuid;
$arg['clusterName'] = $resultList[$i]['colonyName'];
}
简化后方法
foreach,key替代上面i;
foreach ($resultList as $key => $value) {
$arg[] = $value['colonyName'];
}