PHP之clearstatcache()

PHP中使用缓存可以提供某些便捷 ,但有时也会因为缓存导致数据没能及时更新,所以此时,需要使用clearstatcache()函数清除缓存。

Definition and Usage

The clearstatcache() function clears the file status cache.

PHP caches data for some functions for better performance. If a file is being checked several times in a script, you might want to avoid caching to get correct results. To do this, use the clearstatcache() function.

Syntax


 

Tips and Notes

Tip: Functions that are caching:

  • 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()

Example


摘自:http://www.w3schools.com/php/func_filesystem_clearstatcache.asp

发表评论