多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
![](https://img.kancloud.cn/0a/e9/0ae9f408e69092d75552af9462249fd2_420x759.png) 把数组二中和数组一key一样的值作为新数组的key ``` [ 'customerId'=>'阿康', 'code'=>'132145646', ] ``` ~~~ /** * 替换新的键 * * @param array $datas * @param array $map * @param array $notRequiresColumnWithValue */ public function doReplaceKey(&$datas = [], $map = [], $notRequiresColumnWithValue = []) { array_walk($datas, function (&$value) use ($map,$notRequiresColumnWithValue) { $k = array_intersect_key($map, $value); $v = array_intersect_key($value, $map); $value = array_combine($k, $v); if (!empty($notRequiresColumnWithValue)) { $value = array_merge($value, $notRequiresColumnWithValue); } }); } ~~~ ```