2
同我試圖同時使圖像在我的服務器如何檢測,如果圖像名稱不同,但圖像是在PHP
1.如果圖像名稱來驗證不同,但圖像是相同的,然後什麼也不做。
我怎樣才能檢測到
我的代碼看起來是這樣的
if (file_exists($ficherof)) {
$x=file_get_contents($ficherof) ;
if($imagen['sha1']!=sha1($x))
{
//do something
}
}
else
//here I have to check if the file name is different but the files are same then donot upload
file_put_contents($ficherof, $contenido);
獲取兩個文件內容並進行比較,使用'sha1_file()'進行比較,速度要快得多。 – Daan 2015-04-03 12:07:11
@Daan抱歉,它的圖像混亂,所以我應該怎麼做,在這方面 – Vikram 2015-04-03 12:08:52
有一個很好的答案[這裏](http://stackoverflow.com/a/29253608/1685196)。 – Michel 2015-04-03 12:10:46