search
Homephp教程php手册php clearstatcache -清除文件状态缓存

php clearstatcache -清除文件状态缓存

Jun 13, 2016 am 11:17 AM
clearstatcachephpaboutdocumentClearstatecache

关于php clearstatcache -清除文件状态缓存 下面我们一一讲解了,还有具体的实例哦。  

关于php clearstatcache -清除文件状态缓存 下面我们一一讲解了,还有具体的实例哦。

clearstatcache
( PHP 4中, PHP 5中)

clearstatcache -清除文件状态缓存

描述
无效clearstatcache ( [布尔$ clear_realpath_cache =虚假[ ,字符串$文件名] ] )
当您使用统计( ) , lstat ( ) ,或任何其他职能中列出的受影响的功能列表中(如下) , PHP的缓存信息恢复这些职能,以提供更快的性能。然而,在某些情况下,您可能要清除缓存信息。例如,如果相同的文件正在检查多次在一个脚本,该文件是危险的删除或更改在该脚本的运行,你可以选择清除缓存的地位。在这种情况下,您可以使用clearstatcache ( )函数明确的信息, PHP的缓存有关文件。

你也应该注意到, PHP不缓存信息不存在的文件。因此,如果您要求file_exists ( )上的文件不存在,它会返回FALSE ,直到您创建文件。如果您创建的文件,它会返回即使您然后删除该文件。然而断开( )自动清除缓存。

注:此功能缓存信息的具体文件名,所以你只需要调用clearstatcache ( )如果您是从事多种业务在同一文件名,并要求有关该特定文件不被缓存。


受影响的功能包括统计( ) , lstat ( ) , file_exists ( ) , is_writable ( ) , is_readable ( ) , is_executable ( ) , is_file ( ) , is_dir ( ) , is_link ( ) , filectime ( ) , fileatime ( ) , filemtime ( ) , fileinode ( ) ,档案群组( ) , fileowner ( ) ,档案大小( ) ,文件类型( ) ,和fileperms ( ) 。

参数

clear_realpath_cache
每当清除缓存或不realpath (默认为false ) 。

文件名
明确realpath缓存的具体文件名,如果只使用clear_realpath_cache是真实的。


返回值
没有价值的返回。

修改

版本说明
5.3.0时间可选clear_realpath_cache和文件名参数。


实例

例如# 1 clearstatcache ( )的例子

$file = 'output_log.txt';

function get_owner($file)
{
    $stat = stat($file);
    $user = posix_getpwuid($stat['uid']);
    return $user['name'];
}

$format = "UID @ %s: %sn";

printf($format, date('r'), get_owner($file));

chown($path, 'ross');
printf($format, date('r'), get_owner($file));

clearstatcache();
printf($format, date('r'), get_owner($file));
?>
输出

UID @ Sun, 12 Oct 2008 20:48:28 +0100: root
UID @ Sun, 12 Oct 2008 20:48:28 +0100: root
UID @ Sun, 12 Oct 2008 20:48:28 +0100: ross


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.