关于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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

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),

SublimeText3 Linux new version
SublimeText3 Linux latest version

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
