Home  >  Article  >  php教程  >  php filesize 函数

php filesize 函数

WBOY
WBOYOriginal
2016-06-13 11:17:191562browse

php filesize 函数  

filesize
( PHP 4中, PHP 5中)

filesize-获取文件大小

描述
国际filesize(字符串$文件名)
获得大小给定的文件。

参数

文件名
文件路径。


返回值
回报文件的大小以字节为单位,或FALSE (和产生错误的水平E_WARNING )情况下的一个错误。

注意:由于PHP的整数类型的签署和许多平台使用32位整数,filesize( )可能会返回意想不到的结果的文件的容量大于2GB 。对于文件的2GB和4GB的大小这通常可以克服使用sprintf ( “ % U ”型,filesize( $档案) ) 。

实例

例如# 1filesize( )的例子

// outputs e.g.  somefile.txt: 1024 bytes

$filename = 'somefile.txt';
echo $filename . ': ' . filesize($filename) . ' bytes';

?>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn