我正在测试PHP clearstatchache函数,如下所示:
//[1] First attempt to access non-existent file
var_dump(file_exists("gates.txt"));
返回false
//[2] Now manually create the file in the directory.
//[3] Run the script again.
它返回true。
//[4] manually delete the file
//[5] run script once again
返回false
现在从我对以下行的理解来看 http://www.php.net/manual/en/function.clearstatcache.php
“您还应注意PHP不会缓存有关不存在文件的信息。因此,如果您在不存在的文件上调用file_exists(),则在您创建文件之前它将返回FALSE。如果您创建该文件,即使您删除该文件,它也将返回TRUE。“
手动删除文件后,该函数应返回true。
任何解释都会有所帮助!
答案 0 :(得分:2)
缓存只是每个脚本运行。