This article to share the content is about PHP Clearstatcache, has a certain reference value, the need for friends can refer to
The function of the
clearstatcache () function is to clear the file state cache. The
PHP cache data is advantageous for faster and better running functions. If a file is tested
multiple times in a script, you may disallow caching of the correct results. To achieve this, you can use the
Clearstatcache () function.
When you use Stat (), Lstat (), or any of the functions listed in the affected function table (see below),
PHP caches the return information for these functions to provide faster performance. In some cases, however, you might
want to clear the cached information. For example, if you check the same file multiple times in a script and the file is at risk of being deleted or modified during the execution of the
script, you need to clear the file state cache. In this case
, you can use the Clearstatcache () function to clear the file information that is cached by PHP. The
must be aware that PHP does not cache its information for files that do not exist. So if you call
File_exists () to check for a nonexistent file, it returns
FALSE before the file is created. If the file is created, it will return TRUE if it is later deleted
Note: This function caches information for a specific file name, so you need to call Clearstatcache () only if you have multiple operations on the same file name and
require that the file information not be cached.
Syntax
Clearstatcache ()
Hints and notes
Prompt: Functions that perform caching:
stat ()
Lstat ()
file_exists ()
is_writable ()
Is_readable ()
is_executable ()
Is_file ()
Is_dir ()
Is_link ()
Filectime ()
Fileatime ()
Filemtime ()
Http://www.ibwen.com Ebowen provides a huge amount of information to satisfy your curiosity!
All resources of this site are reproduced from the internet! Copyright by author all
Http://www.ibwen.com
Fileinode ()
Filegroup ()
Fileowner ()
FileSize ()
filetype ()
Fileperms ()
Case
<?php//check filesizeecho filesize ("test.txt"); echo "<br/>"; $file = fopen ("Test.txt", "A +");//Truncate Fileftruncate ($file, +), fclose ($file),//clear cache and check filesize againclearstatcache (); Echo FileSize (" Test.txt ");? >
The code above will output the following result:
792
100
Related recommendations:
PHP Clearstatcache () function use detailed