💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
![](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); } }); } ~~~ ```