PHP中的clearstatcache()函数
该clearstatcache()方法清除文件状态缓存。
PHP缓存以下函数返回的信息-
stat()
lstat()
文件已存在()
is_writable()
is_read()
is_executable()
is_file()
is_dir()
文件组()
fileowner()
文件大小()
文件类型()
fileperms()
这样做是为了提供增强的性能。
语法
void clearstatecache()
参数
不适用
返回
该clearstatcache()函数不返回任何值。
示例
以下是检查文件“tmp.txt”并清除缓存的示例。
<?php
$file = fopen("tmp.txt", "a+");
//清除缓存
clearstatcache();
echo "缓存已清除!";
?>输出结果
缓存已清除!