Home > Article > Backend Development > client mac addr PHP clearstatcache function detailed explanation
Definition and usage
The function of clearstatcache() is to clear the file status cache.
PHP’s cached data is very beneficial for running functions faster and better. If a file is tested multiple times in a script, you might disable caching of correct results. To achieve this, you can use the clearstatcache() function.
Syntax
clearstatcache()
Tips and Notes
Tip: Functions that perform caching:
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 code The 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 above introduces the detailed explanation of client mac addr PHP clearstatcache function, including the content of client mac addr. I hope it will be helpful to friends who are interested in PHP tutorials.