当前位置:Gxlcms > PHP教程 > php获得文件大小和文件创建时间

php获得文件大小和文件创建时间

时间:2021-07-01 10:21:17 帮助过:24人阅读

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

  1. Returning information about a file
  2. print "The size of the file is ";
  3. print filesize( "samplefile.doc" );
  4. print "
    ";
  5. $atime = fileatime( "samplefile.doc" );
  6. print "This file accessed on ";
  7. print date("l, M d, Y g:i a", $atime);
  8. print "
    ";
  9. $mtime = filemtime( "samplefile.doc" );
  10. print "This file was modified on ";
  11. print date("l, M d, Y g:i a", $mtime);
  12. print "
    ";
  13. $ctime = filectime( "samplefile.doc" );
  14. print "This file was changed on ";
  15. print date("l, M d, Y g:i a", $ctime);
  16. ?>

php

人气教程排行