$data=array(); //循環頁面 foreach($config_content['pages'] as $page_type_key=>$page_type_val){ if($page_type_val['page_type']==$page_type){ //循環模塊 foreach($config_content['pages'][$page_type_key]['blocks'] as $block_type_key=>$block_type_val){ if($block_type_val['blocktype']==$blocktype){
foreach($_POST as $key=>$val){ if(is_string($val)){ $data[$key] = trim($val); }else{ $data[$key] = $val; } } $config_content['pages'][$page_type_key]['blocks'][$block_type_key]['settings']=$data;
break;//代碼優化的地方,跳出內層的foreach循環 } } break;//代碼優化的地方,跳出外層的foreach循環 } }