比如
$array = [
"version" => "1.1",
"connection" => "close",
];
变成
$array = [
"http_version" => "1.1",
"http_connection" => "close",
];
“简单”的方法是:
$arrayPrefix = [];
foreach ($array as $key => $value) {
$arrayPrefix['prefix_' . $key] = $value;
}
$array = $arrayPrefix;
有没有可能用 array_map 之类的函数实现?
慕莱坞森
慕婉清6462132
12345678_0001
largeQ
蓝山帝景
手掌心
www说