我想知道我怎样才能让它更简单......事情是
if($results['experience'] == 0) { loadViev('experience',$experience, $careerGoals,$mainSectionLines); }
if($results['Education'] == 0) { loadViev('Education',$graduate,$careerGoals,$mainSectionLines); }
if($results['Extra'] == 0) { loadViev('Extra',$extra,$careerGoals,$mainSectionLines); }
if($results['Licence'] == 0) { loadViev('Licence',$licence,$careerGoals,$mainSectionLines); }
if($results['Cert'] == 0) { loadViev('Certyfikaty',$cert,$careerGoals,$mainSectionLines); }
if($results['conferences'] == 0){ loadViev('Conferences',$conferences,$careerGoals,$mainSectionLines); }
if($results['Courses'] == 0) { loadViev('Courses',$Courses,$careerGoals,$mainSectionLines); }
if($results['Hobbys'] == 0) { loadViev('Hobby',$hobby,$careerGoals,$mainSectionLines); }
如您所见,如果某些"name" == 0功能将运行,目前大约有 14 种组合,我知道有可能比复制和粘贴整个代码 14 次更快...
结果代码:
$results =[];
foreach ($userChoice as $key => $value) {
$setVal = $value['key'];
$results[$setVal] = $value['order'];
}
结果只获取一个部分的名称和订单nr。' $userChoice' 只是一个包含数据的数组
有人知道我该怎么做吗?此外,结果是收集所有部分数据(14 个部分),如您所见,我只需要选择 8 个。
扬帆大鱼
Qyouu