Xử lý file text với PHP – Text file with php

1/ So sánh 2 file text:

Dùng function hash_file(“giải thuật: md5, sha256…”, “tên file”);

ví dụ (đã test):

$ash1 = hash_file(“md5″,”1.txt”);
$hash2 = hash_file(“md5″,”2.txt”);
if ($hash1 !== $hash2){
echo “2 file khac nha \n”;
}
if ($handle) {
while (($line = fgets($handle)) !== false) {
echo $line;
}
    fclose($handle);
} else {
// error opening the file.
}
?>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s