我已经在PHP中编写了此代码,因为我想练习文件处理。
PHP TestDo you want to make a new file (NF), edit a file (EF), or delete a file (DF)?
$FileCommand = $_GET['FileHandling'];
if($FileCommand == 'NF') {
echo "
";
echo "What is the new file's name?
";
echo "
";
echo "
";
$FileName = $_GET['CreateFile'];
echo $FileName;
if(null !== $FileName) {
echo $FileName;
echo "yes";
$CreateTheFile = fopen($FileName, 'w');
} else {
echo "No file name chosen. ";
}
}
?>
但是,选择“ NF”并键入文件名后出现问题。无法创建该文件:echo $FileName;
if(null !== $FileName) {
echo $FileName;
echo "yes";
$CreateTheFile = fopen($FileName, 'w');
}