PHP Cache data is very advantageous for faster and better function running. If a file is tested multiple times in the script, you may not cache the correct results. To achieve this, you can use the clearstatcache () function.
Definition and usage
The clearstatcache () function is used to clear the file status cache.
PHP Cache data is very advantageous for faster and better function running. If a file is tested multiple times in the script, you may not cache the correct results. To achieve this, you can use the clearstatcache () function.
Syntax
Clearstatcache ()
Tips and notes
Tip: execute the cache function:
Stat ()
Lstat ()
File_exists ()
Is_writable ()
Is_readable ()
Is_executable ()
Is_file ()
Is_dir ()
Is_link ()
Filectime ()
Fileatime ()
Filemtime ()
Fileinode ()
Filegroup ()
Fileowner ()
Filesize ()
Filetype ()
Fileperms ()
Case
// Check filesize Echo filesize ("test.txt "); Echo" "; $ File = fopen ("test.txt", "a + "); // Truncate file Ftruncate ($ file, 100 ); Fclose ($ file); // Clear cache and check filesize againcle Arstatcache (); Echo filesize ("test.txt "); ?> |
The above code will output the following results:
792100