[英]filectime() is not changing (even if file is deleted manually)
我有以下代碼:
<?php
function logAction($action,$file){
/**
* delete the file
*/
if((time()-filectime(ROOT_PATH.'/logs/'.$file)) > LOG_CLEAN){
unlink(ROOT_PATH.'/logs/'.$file);
};
/**
* write the action
*/
$f = fopen(ROOT_PATH.'/logs/'.$file,'a');
$data = "[".date('d-m-Y H:i:s')."] ".$action."\n";
fwrite($f,$data);
fclose($f);
return true;
};
?>
問題是:filectime()不會更改值。 當我寫下來時,即使生成了新文件(例如,如果我手動刪除日志文件),它也保持不變。
我的代碼有什么問題?
提前致謝。
結果filectime()
函數被緩存。 使用clearstatcache()
清除緩存。 clearstatcache()
函數清除文件狀態緩存。 在這里查看文檔php filectime() php clearstatcache()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.