foreach ($permissions as $key=>$val){
$resKey = $val['system_short_name']."-".$val['model_short_name'];
$res[$resKey]['system_short_name'] = $val['system_short_name'];
$res[$resKey]['model_short_name'] = $val['model_short_name'];
foreach ($type as $k=>$v){
//此处不加判断的话会不断的覆盖下面添加的结果
if (!isset($res[$resKey][$v['look_up_val']])){
$res[$resKey][$v['look_up_val']] = ['disable'=>1];
}
if($val['function_type'] == $v['id']){
$res[$resKey][$v['look_up_val']] = [
'disable'=>0,
'checked' => 1,
'id' => $val['id']
];
}
}
}
php循环添加数据时遇到的坑
最新推荐文章于 2021-04-08 14:33:22 发布