Home > Backend Development > PHP Tutorial > php get file size and file creation time

php get file size and file creation time

WBOY
Release: 2016-07-25 08:43:48
Original
914 people have browsed it

Various attributes of files can be displayed in php, including the last access time, last modification time, file size, etc. of the file.

  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. ?>
Copy code

php


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template