Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/243.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP比较文件校验和或更深_Php_File_Comparison - Fatal编程技术网

PHP比较文件校验和或更深

PHP比较文件校验和或更深,php,file,comparison,Php,File,Comparison,你好 我有一个复杂的问题(至少对我来说是这样) 已被要求创建上载引擎管理文件的系统,并将引擎管理文件与系统中已有的引擎管理文件进行比较。并检查是否有任何匹配的文件。所以说奥迪提供的特定发动机也被Seat使用,所以它会返回匹配结果 但我在文件比较方面没有这样的经验。 有可用的工具吗 可能的工具,也可以给我一个匹配的百分比。例如:匹配率约为73% 蒂亚德 p.S.我的问题非常少,已经进行了搜索,原因是我也不知道要查找什么搜索词。因此,即使是这样,也会朝着正确的方向踢一脚校验和 您可能需要查找功能:

你好

我有一个复杂的问题(至少对我来说是这样) 已被要求创建上载引擎管理文件的系统,并将引擎管理文件与系统中已有的引擎管理文件进行比较。并检查是否有任何匹配的文件。所以说奥迪提供的特定发动机也被Seat使用,所以它会返回匹配结果

但我在文件比较方面没有这样的经验。 有可用的工具吗

可能的工具,也可以给我一个匹配的百分比。例如:匹配率约为73%

蒂亚德

p.S.我的问题非常少,已经进行了搜索,原因是我也不知道要查找什么搜索词。因此,即使是这样,也会朝着正确的方向踢一脚

校验和 您可能需要查找功能:

<?php

$firstFile = '/tmp/foo.jpg';
$secondFile = '/tmp/bar.jpg';

$algo = 'md5';

if (hash_file($algo, $firstFile) === hash_file($algo, $secondFile)) {
    // files should be the same
}
其中:

file1.txt and file1.txt are the same files
file1.txt and file2.txt are 17.340286831812% the same
file1.txt and file3.txt are completely different
这里,
file3.txt
为空

校验和 您可能需要查找功能:

<?php

$firstFile = '/tmp/foo.jpg';
$secondFile = '/tmp/bar.jpg';

$algo = 'md5';

if (hash_file($algo, $firstFile) === hash_file($algo, $secondFile)) {
    // files should be the same
}
其中:

file1.txt and file1.txt are the same files
file1.txt and file2.txt are 17.340286831812% the same
file1.txt and file3.txt are completely different

此处,
file3.txt
为空

您可能想进一步说明引擎管理文件是什么,例如,它是文本还是二进制、平均大小等。百分比比较还需要一些详细信息。至少要比较哪些指标。如果引擎管理文件不是二进制文件,请查看Agree with@AlexBlex-您需要在问题中讨论您的文件类型。假设它是XML,然后您会告诉我们您已经搜索了
php diff XML
diff
是文件比较的关键字),然后在您尝试执行某项操作后询问下一步的操作……您可能想告诉更多引擎管理文件是什么,例如,它是文本还是二进制平均大小,百分比比较还需要一些细节。至少要比较哪些指标。如果引擎管理文件不是二进制文件,请查看Agree with@AlexBlex-您需要在问题中讨论您的文件类型。假设它是XML,然后你会告诉我们你已经搜索了
php diff-XML
diff
是文件比较的关键字),然后在尝试做某事后询问下一步的步骤。。。
file1.txt and file1.txt are the same files
file1.txt and file2.txt are 17.340286831812% the same
file1.txt and file3.txt are completely different