1

嗨,当我的网站中包含缓存脚本时,我收到此错误..

Warning: filemtime() [function.filemtime]: stat failed for index.php in C:\xampp\htdocs\Content\content\cache.php on line 6

这是脚本:

<?php
class datemod{
    public $gmtime;
    function date($files,$dbtable,$url){
        foreach($files as $val){
            $mod=date('Y/m/d H:i:s',filemtime($val));
            $array[]=$mod;
        }
        $fmod=max($array);
        $result=mysql_query("SELECT DATE_FORMAT(pubdate,'%Y/%m/%d %H:%i:%s') AS pubdate FROM $dbtable WHERE url='$url'");
        while($row=@mysql_fetch_array($result,MYSQL_ASSOC)){
            $row[]=array('row'=>array_map('htmlspecialchars',$row));
            $pubdate=$row['pubdate'];
        }
        $maxmod=max($fmod,$pubdate);
        $this->gmtime=date('D, d M Y H:i:s T',strtotime($maxmod));
    }
    function cache($gmtime){
        if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])||isset($_SERVER['HTTP_IF_NONE_MATCH'])){
            if($_SERVER['HTTP_IF_MODIFIED_SINCE']==$gmtime){
                header('Status:304 Not Modified',true,304);
                exit();
            }
        }
        header("Last-Modified:$gmtime");
    }
}
?>

我似乎找不到它有什么问题..有什么帮助吗?

4

2 回答 2

2

触发警告是因为当前目录中没有文件index.php(可以使用 检索getcwd()

于 2011-04-20T00:27:47.133 回答
1

这意味着传递给的文件filemtime()不存在,或者程序没有访问其属性的权限。

也许从显示或记录开始$val,看看它是否是预期的。如果那里一切正常,请检查文件权限,包括路径中每个目录的权限。

于 2011-04-20T00:26:11.847 回答