Php methods for obtaining file types and information,
This document describes how to obtain file types and information by using php. Share it with you for your reference. The specific implementation method is as follows:
<? Php $ file = "php.txt"; // open the file. r indicates to open $ handle = fopen ($ file, "r") in read-only mode "); // get the statistics of the file $ fstat = fstat ($ handle); echo "file name :". basename ($ file ). "<br>"; // echo "file size :". round (filesize ("$ file")/, 2 ). "kb <br>"; echo "file size :". round ($ fstat ["size"]/1024,2 ). "kb <br>"; // echo "last access time :". date ("Y-m-d h: I: s", fileatime ($ file )). "<br>"; echo "last access time :". date ("Y-m-d h: I: s", $ fstat ["atime"]). "<br>"; // echo "last modification time :". date ("Y-m-d h: I: s", file Mtime ($ file )). "<br>"; echo "last modification time :". date ("Y-m-d h: I: s", $ fstat ["mtime"]);?>
I hope this article will help you with php programming.