我是靠谱客的博主 冷傲荔枝,这篇文章主要介绍PHP clearstatcache()函数详解,现在分享给大家,希望可以做个参考。

定义和用法
clearstatcache()函数的作用是:清除文件状态缓存。
PHP的缓存数据对更快更好的运行函数是非常有利的。如果一个文件在脚本中测试了多次,你也许会禁止对正确的结果进行缓存。为了实现这点,你可以使用clearstatcache()函数。
语法
clearstatcache()
提示和注意
提示:执行缓存的函数:
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()
案例

复制代码 代码如下:

<?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");
?>

上述代码将输出下面的结果:
792100

最后

以上就是冷傲荔枝最近收集整理的关于PHP clearstatcache()函数详解的全部内容,更多相关PHP内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(114)

评论列表共有 0 条评论

立即
投稿
返回
顶部