Skip to content

Instantly share code, notes, and snippets.

@yasuken1990
Created January 22, 2019 16:30
Show Gist options
  • Save yasuken1990/9a612b62fa799aff7ec051269eb6bf91 to your computer and use it in GitHub Desktop.
Save yasuken1990/9a612b62fa799aff7ec051269eb6bf91 to your computer and use it in GitHub Desktop.
<?php
// php pearCheck.php basePath targetPath
const COMPLETE_MESSAGE = 'OK';
const ERROR_MESSAGE = 'NG';
echo checkMd5Files($argv[1], $argv[2]);
function checkMd5Files($basePath, $targetPath) {
$baseHash = md5_file($basePath);
$targetHash = md5_file($targetPath);
if ($baseHash === $targetHash) {
return COMPLETE_MESSAGE;
} else {
return ERROR_MESSAGE ;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment