DirectoryIterator::getSize

(PHP 5, PHP 7)

DirectoryIterator::getSizeGet size of current DirectoryIterator item

说锟斤拷

public DirectoryIterator::getSize ( void ) : int

Get the file size for the current DirectoryIterator item.

锟斤拷锟斤拷

锟剿猴拷锟斤拷没锟叫诧拷锟斤拷锟斤拷

锟斤拷锟斤拷值

Returns the size of the file, in bytes.

锟斤拷锟斤拷

Example #1 DirectoryIterator::getSize() example

<?php
$iterator 
= new DirectoryIterator(dirname(__FILE__));
foreach (
$iterator as $fileinfo) {
    if (
$fileinfo->isFile()) {
        echo 
$fileinfo->getFilename() . " " $fileinfo->getSize() . "\n";
    }
}
?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

apple.jpg 15385
banana.jpg 15190
example.php 170
pear.jpg 34406

锟轿硷拷

  • filesize() - 取锟斤拷锟侥硷拷锟斤拷小