我注意到安装PHP脚本的目录有非常大的error_log文件,几乎有1 1GB大小,大多数错误是由第478行和第479行编码生成的。来自error_log文件的错误示例如下:
PHP Warning: filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/khan/public_html/folder/ZBall.jar in /home/khan/public_html/folder/index.php on line 478
PHP Warning: filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/khan/public_html/folder/ZBall.jar in /home/khan/public_html/folder/index.php on line 479我有以下代码,第477行到第484行
foreach ($mp3s as $gftkey => $gftrow) {
$ftimes[$gftkey] = array(filemtime($thecurrentdir.$gftrow),$gftrow);
$ftimes2[$gftkey] = filemtime($thecurrentdir.$gftrow);
}
array_multisort($ftimes2,SORT_DESC,$ftimes);
foreach ($ftimes as $readd) {
$newmp3s[] = $readd[1];
}请在这方面帮帮我。
谢谢..:)
发布于 2011-12-31 03:37:01
stat failed错误表示文件/home/khan/public_html/games/ZBall.jar不存在,或者由于权限错误而无法读取。确保文件存在于PHP正在查找的位置,因为这似乎是导致问题的最大原因。
由于它来自数组$mp3s,请确保该数组包含存在的文件名,如果不存在,则对其进行修改。
发布于 2011-12-31 03:39:16
在使用该文件之前,请先请求该文件。检查我的编辑:
<?php
foreach ($mp3s as $gftkey => $gftrow) {
if (file_exists($thecurrentdir.$gftrow)) {
$ftimes[$gftkey] = array(filemtime($thecurrentdir.$gftrow),$gftrow);
$ftimes2[$gftkey] = filemtime($thecurrentdir.$gftrow);
}
}
array_multisort($ftimes2,SORT_DESC,$ftimes);
foreach ($ftimes as $readd) {
$newmp3s[] = $readd[1];
}发布于 2015-08-24 03:41:16
PHP.net网站上有一个功能,可以消除Windows上关于filemtime的错误
function GetCorrectMTime($filePath) {
$time = filemtime($filePath);
$isDST = (date('I', $time) == 1);
$systemDST = (date('I') == 1);
$adjustment = 0;
if($isDST == false && $systemDST == true)
$adjustment = 3600;
else if($isDST == true && $systemDST == false)
$adjustment = -3600;
else
$adjustment = 0;
return ($time + $adjustment);
}来源:http://php.net/manual/tr/function.filemtime.php#100692
https://stackoverflow.com/questions/8683281
复制相似问题