我有一個頁面調用的index.php這是在調用一個函數「WRITELOG」包括/ Logger.phpPHP寫文件錯誤
我已經文件位於包含文件夾,代碼如下所示。
function writelog($logText){
$myFile = "testlog.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $logText + "\n";
fwrite($fh, $stringData);
fclose($fh);
}
它顯示errror「無法打開文件」。我爲每個人設置了FullPermission,但它仍然無法訪問文件。我試圖將文件放在與index.php相同的文件夾中,並且出現同樣的錯誤。可能的原因是什麼?我錯了路嗎?