Warning: filemtime(): stat failed for includes\img\defaultimg.jpg in我阅读和研究,但没有发现任何有用的东西。
在php手册中,只这样写着:
If PHP's integer type is only 32 bits on your system, filemtime() will fail on files over 2GB with the warning "stat failed". All stat()-related commands will exhibit the same behavior.但只是一个jpg 900 k
这是我的代码在xammp中工作得很好,但在生产中却不起作用。
$dirimg="includes/img/"; //this one also throws warning
$filename = "".$dirimg."".$resultsb['Img'].".jpg"; //the path
if(file_exists ($filename)){ // exists?
$timeimg=filemtime($filename);
$srci="".$dirimg."".$resultsb['Img'].".jpg?=".$timeimg."";
}else{$timeimg=filemtime("includes\img\defaultimg.jpg"); //another path, the file does exists
$srci="includes\img\defaultimg.jpg?=".$timeimg.""; } // 在各自的路径中都抛出相同的警告,该文件就会退出
可以看到图像,但我需要知道它何时被修改,以便浏览器刷新它。
发布于 2020-04-22 19:46:16
它是斜杠哈哈,服务器在Linux中所以,它们必须是“include/img/defaultimg.jpg?=”而不是"includes\img\defaultimg.jpg?=“。
LOL
https://stackoverflow.com/questions/61372886
复制相似问题