开发者

PHP - filemtime function error

Hi i get this error when a cache script is included in my site..

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

Here is the script:

<?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");
    }
}
?>

I cant seem to find whats wrong with it.. any help?


The warning is triggered because there is no file index.php in the current dir (can be retrieved using getcwd())


It means that either file passed to filemtime() doesn't exist, or the program doesn't have permission to access its attributes.

Maybe begin by displaying or logging $val to see if it is what is expected. If all looks well there, then check the file permissions, including of every directory in the path.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜