Ved du tilfældigvis hvad jeg skal gøre her (taget ud fra artikel
http://www.eksperten.dk/artikler/504) for at gemme indholdet af filen i html format i mappen cache/fil.htm <-- Jeg har givet chmod-adgang..
<?php
echo "Hej";
function loadCache($dir, $file) {
if (!is_readable($dir.$file)) {
echo "Fejl";
} else {
$buffer = '';
$fd = fopen ($dir.$file, "r");
while (!feof($fd)) $buffer .= fgets($fd);
fclose ($fd);
}
return $buffer;
}
function saveCache($dir, $file, $cache, $backupdir='') {
# 0x1 : File cached
# 0x2 : Directory doesnt exist
# 0x4 : Directory not writable
# 0x8 : Backup directory doesnt exist
# 0x10 : Backup directory not writable
if (!is_dir($dir)) $status += 0x2;
else if (!is_writable($dir)) $status += 0x4;
else {
$cachefile = $dir.$file;
$backupfile = $backupdir.$file;
if ($backupdir && file_exists($cachefile)) {
if (!is_dir($backupdir)) $status += 0x8;
else if (!is_writable($backupdir)) $status += 0x10;
else {
if (file_exists($backupfile)) unlink($backupfile);
rename($cachefile, $backupfile);
}
}
$fp = fopen($cachefile, 'w');
fputs($fp, $cache);
fclose($fp);
$status += 0x1;
}
return $status;
}
function deleteCache($dir, $file) {
if (file_exists($dir.$file)) unlink($dir.$file);
return true;
}
?>