本文实例讲述了php获得文件大小和文件创建时间的方法。分享给大家供大家参考。具体分析如下:

php中可以显示文件的各种属性,这些属性包括文件的最后访问时间、最后修改时间、文件大小等。

<HTML>
<HEAD>
<TITLE>Returning information about a file</TITLE>
</HEAD>
<BODY>
<"The size of the file is ";
print filesize( "samplefile.doc" );
print "<br>";
$atime = fileatime( "samplefile.doc" );
print "This file accessed on ";
print date("l, M d, Y g:i a", $atime);
print "<br>";
$mtime = filemtime( "samplefile.doc" );
print "This file was modified on ";
print date("l, M d, Y g:i a", $mtime);
print "<br>";
$ctime = filectime( "samplefile.doc" );
print "This file was changed on ";
print date("l, M d, Y g:i a", $ctime);
"htmlcode">
<"$filename was last modified: " . date ("F d Y H:i:s.", filemtime($filename));

}
"htmlcode">
<"$filename was last changed: " . date ("F d Y H:i:s.", filectime($filename));
}
"htmlcode">
<"$filename was last accessed: " . date ("F d Y H:i:s.", fileatime($filename));
}
?>

希望本文所述对大家的php程序设计有所帮助。

标签:
php,获得,文件,大小,创建时间,方法

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com

评论“php获得文件大小和文件创建时间的方法”

暂无“php获得文件大小和文件创建时间的方法”评论...