1
我正在嘗試編寫腳本,試圖將圖像從舊服務器移動到Amazon s3。是否可以通過從url下載圖像來完成?將圖像從一臺服務器移動到s3 PHP Laravel 5.3
$companies = Company::all();
$companies->each(function ($company) {
//some method to download file
$file = download($company->logo);
//Store on s3
$filename = $file->storeAs('images', uniqid('img_') . "." . $file->guessClientExtension(),'s3');
//Get the new path
$new_path = Storage::disk('s3')->url($filename);
//save the new path to logo
$company->logo = $new_path;
//save the new path
$company->save();
}
是的,使用curl/guzzle或編寫腳本來通過ssh移動圖像 – Indra