🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
![](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); } }); } ~~~ ```