PHP gets file attributes can be implemented in a variety of functions, each of which allows us to get a variety of information about the file, and then we will look at the different ways to get the file properties of PHP.
PHP Gets the file attributes last modified time:
< php $file = ' test.txt '; echo Date (' R ', Filemtime ($file)); ? >
Returns a timestamp that says Unix, which is commonly used in caching techniques.
The relevant PHP gets the file attributes of the last accessed time Fileatime (), Filectime () when the permissions of the file, owner, all groups or other inode metadata is updated time, Fileowner () function returns the file owner
$owner = Posix_getpwuid (Fileowner ($file));
(Non-Window System), Ileperms () Gets the file permissions,
< php $file = ' dirlist.php '; $perms = substr (sprintf ('%o ', Fileperms ($file)),-4); echo $perms; ? >
FileSize () returns the number of bytes in the file size:
< PHP //output similar to: somefile.txt:1024 bytes $filename = ' somefile.txt '; Echo $filename. ': ' . FileSize ($filename). ' bytes '; ? >
PHP gets all the information about the properties of a file with a function stat () function that returns an array:
< php $file = ' dirlist.php '; $perms = stat ($file); Var_dump ($perms); ? >