.
).
在Windows中,如果文件具有hidden属性,则该文件是隐藏的。
function file_hidden($file) {
if (!file_exists($file))
return false;
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$attributes = shell_exec('attrib ' . escapeshellarg($file));
// Just get the attributes
$attributes = substr($attributes, 0, 12);
if ($attributes === 'File not fou')
return false;
// Return if hidden
return (strpos($attributes, 'H') !== false);
} else {
$basename = basename($file);
return ($basename[0] === '.');
}
}