當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。