1

如何用 PHP 获取目录大小

 1 year ago
source link: https://blog.p2hp.com/archives/8741
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

如何用 PHP 获取目录大小

如何用 PHP 获取目录大小

function GetDirectorySize($path){
$bytestotal = 0;
$path = realpath($path);
if($path!==false && $path!='' && file_exists($path)){
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)) as $object){
$bytestotal += $object->getSize();
return $bytestotal;

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK