当前位置: 首页>>编程示例 >>用法及示例精选 >>正文


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!

相关用法


注:本文由纯净天空筛选整理自Karthikeya Boyini大神的英文原创作品 clearstatcache() function in PHP。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。