我試圖創建文件夾目錄名稱「代碼」,並且我想將它保存到「status.txt」。收到意外T_CONSTANT_ENCAPSED_STRING,創建目錄
這是我的代碼問題,收到意想不到的T_CONSTANT_ENCAPSED_STRING。
if(is_writeable($newdir . "/status.txt")) {
if (fwrite($statusTxt, $statusCode . "," . $status . "," . $share . "," . $date . "," . $permission "\n")){
}
這種方式是正確的創建一個目錄並將其保存到status.txt? 下面是其餘的代碼。
非常感謝,感謝您的幫助。
$newdir = "../../data/code";
umask(0007);
if(!file_exists($newdir))
{
mkdir($newdir, 02770);
$statusTxt = fopen($newdir. "/status.txt", "a");
}
if(is_writeable($newdir . "/status.txt")) {
if (fwrite($statusTxt, $statusCode . "," . $status . "," . $share . "," . $date . "," . $permission "\n")){
}
echo "<p>Your form has succesfully been submit!</p>";
}
fclose($statusTxt);
}
您在fwrite調用的最後一個'\ n'之前缺少'.'。 – andrewsi