Last active
August 28, 2018 15:19
-
-
Save flxxyz/22b204f33cfff8451ff46819a7b52894 to your computer and use it in GitHub Desktop.
读取大于2GB以上的文件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_safe_filesize($file) | |
{ | |
$size = filesize($file); | |
if ($size <= 0) { | |
if (!(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')) { | |
$size = trim(`stat -c%s $file`); | |
} else { | |
$fsobj = new COM("Scripting.FileSystemObject"); | |
$f = $fsobj->GetFile($file); | |
$size = $f->Size; | |
} | |
} | |
return $size; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment