php獲得文件大小和文件創建時間

cxx3 9年前發布 | 843 次閱讀 PHP

php中可以顯示文件的各種屬性,這些屬性包括文件的最后訪問時間、最后修改時間、文件大小等。

<HTML>
<HEAD>
<TITLE>Returning information about a file</TITLE>
</HEAD>
<BODY>
<?
print "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);
?>
</BODY>
</HTML>

 本文由用戶 cxx3 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!