在PHP中的clearstatcache()函数

WBOY
WBOY 转载
2023-09-07 09:34:01 166浏览

在PHP中的clearstatcache()函数

clearstatcache() 函数用于清除文件状态缓存。

PHP 缓存以下函数返回的信息 −

  • stat()
  • lstat()
  • file_exists()
  • is_writable()
  • is_readable()
  • is_executable()
  • is_file()
  • is_dir()
  • filegroup()
  • fileowner()
  • filesize()
  • filetype()
  • fileperms()

这样做是为了提供更好的性能。

语法

void clearstatecache()

参数

  • NA

返回值

clearstatcache()函数不返回任何值。

示例

以下是一个示例,用于检查文件“tmp.txt”并清除缓存。

在线演示

<?php
   $file = fopen("tmp.txt", "a+");
   // Clear cache
   clearstatcache();
   echo "Cache cleared!";
?>

输出

Cache cleared!

以上就是在PHP中的clearstatcache()函数的详细内容,更多请关注php中文网其它相关文章!

声明:本文转载于:tutorialspoint,如有侵犯,请联系admin@php.cn删除