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