我有此代碼,將圖像保存到遠程目錄,但我還沒有一個知道在哪裏的代碼,如果文件存在什麼都不做:如何使file_exists工作(Php)?
$album_name = $row['album'];
if(file_exists("cdcovers/$album_name.jpg")){
<---here
}
else {
//save images
$imageString = file_get_contents(LastFMArtwork::getArtwork($row['artist'], $row['album'], true, "large"));
$save = file_put_contents('/home/link/public_html /cdcovers /'.$row['album'].'.jpg',$imageString);
}
我能有什麼想法?
那麼,如果文件存在** **你想要做什麼? – FirstOne
file_exists獨自工作。沒有什麼可以讓它工作。 –
當您調用'file_put_contents'時,爲什麼在路徑名中包含所有這些空格? – Barmar