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 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
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.