PHP filesize()Function


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual

Definition and Usage

The filesize() function returns the size of the specified file.

If successful, the function returns the file size in bytes. If it fails, it returns FALSE.

Syntax

filesize(filename)

Parameter Description
filename Required. Specifies the file to check.


Tips and Notes

Note:The results of this function are cached. Use clearstatcache() to clear the cache.


Example

<?php
echo filesize("test.txt");
?>

The above code will output:

20


PHP Filesystem 参考手册Complete PHP Filesystem Reference Manual Other Extensions