Definition and Usage
The function of the Clearstatcache () is to clear the file state cache.
PHP's cached data is advantageous for faster and better running functions. If a file has been tested multiple times in a script, you may be prevented from caching the correct results. To achieve this, you can use the Clearstatcache () function.
Grammar
Clearstatcache ()
Tips and Notes
Tip: Perform a cached 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
Copy CodeThe code is as follows:
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 code above will output the following result:
792100
http://www.bkjia.com/PHPjc/321402.html www.bkjia.com true http://www.bkjia.com/PHPjc/321402.html techarticle the definition and usage of the Clearstatcache () function is to clear the file state cache. PHP's cached data is advantageous for faster and better running functions. If a file is measured in a script ...