我正在使用unlink()
删除服务器上存在的图像,也获得了许可尝试以下代码。
$exactPath = $siteurl.'/'.$path;
if (file_exists($exactPath)) {
chmod($exactPath, 0777);
@unlink(realpath($exactPath));
}
// See if it exists again to be sure it was removed
if (file_exists($exactPath)) {
echo "Problem deleting " . $exactPath;
} else {
echo "Successfully deleted " . $exactPath;
}
它显示结果为已成功删除,但图像仍然存在于服务器上?
很可能您正在修改图像文件,请尝试将图像文件夹修改为 777