我有一个类似
的数组 "id": "948",
"app_id": "172",
"image": "75733F51448032347-img.png",
"type": "phone",
"created_at": "2015-11-21 02:12:27",
"updated_at": "2015-11-21 02:12:27"
},
{
"id": "950",
"app_id": "172",
"image": "5813pKb1448032353-img.png",
"type": "phone",
"created_at": "2015-11-21 02:12:33",
"updated_at": "2015-11-21 02:12:33"
},
{
"id": "951",
"app_id": "172",
"image": "6864qUU1448032355-img.png",
"type": "phone",
"created_at": "2015-11-21 02:12:35",
"updated_at": "2015-11-21 02:12:35"
}
我想要更改所有项目图像值。我正在使用此代码但无法正常工作
foreach($icon as $key => $value)
{
$icon[2] = asset('uploads/apk-screen/'.$value);
unset($icon[2]);
}
请帮我弄清楚我在做什么。
答案 0 :(得分:1)
最后的工作
foreach($icon as $key => $value)
{
$existngValue=$icon[$key]['image'] = $value['image'];
$newVal=asset('uploads/apk-screen/'.$existngValue);
$icon[$key]['image'] = $newVal;
}