【发布时间】:2018-11-10 20:37:48
【问题描述】:
每当我尝试使用此代码从我的网页中删除我的 cpanel 文件夹中的文件时
$oldFile = @mysql_result(mysql_query("SELECT SUBSTR(`materialLink`, 27) FROM `documents` WHERE `iddocuments` = '$iddoc'"),0, `materialLink`);
$chmod = "0777";
chmod($oldFile,octdec($chmod));
$oldFile = 'https://www.edutopia.co.ke'.$oldFile;
if(isset($_POST['Fild'])){
$msg1 = '<script type="text/javascript">alert("File successfully deleted");</script>';
$msg2 = '<script type="text/javascript>alert("There was an error deleting that file.");</script>"';
$tFile= $_POST['Fild'];
$delFile = "DELETE FROM `documents` WHERE `iddocuments`='$tFile'";
mysql_query($delFile);
unlink($oldFile);
if (mysql_query($delFile)){
echo $msg1;
}
else {
echo $msg2;
}
}
我收到以下错误:
PHP 警告: chmod(): No such file or directory in /home/edutopia/public_html/fDelete.php on line 8
PHP 警告:unlink():无法在第 20 行的 /home/edutopia/public_html/fDelete.php 中找到流包装器
请问有人能找出补救措施吗?
【问题讨论】:
-
在
@mysql_result中使用@ 来抑制错误是您最不需要的。如果有错误,那么你需要处理它们,而不是忽略它们。