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
CopyCode The Code is as follows: <? PHP
// Check filesize
Echo filesize ("test.txt ");
Echo "<br/> ";
$ 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