PHP : Function Reference : HTTP : http_match_etag
root
An Apache-like ETag can be generated like this:
<?php
function etag($filename, $quote = true) {
if (!file_exists($filename) || !($info = stat($filename))) {
return false;
}
$q = ($quote) ? '"' : '';
return sprintf("$q%x-%x-%x$q", $info['ino'], $info['size'], $info['mtime']);
}
?>
|