尝试从服务器删除文件,但收到此错误:
unlink():cURL不允许在.
这是我的代码:
foreach($fDel as $del=>$delval){
$paths = array("art/images/", "art/smallthumbs/", "art/thumbs/");
$imgid = $delval['img_id'];
$fileNm = $delval['img_fname'];
foreach($paths as $x=>$path) {
$file = URL . $path . $fileNm.".jpg";
unlink($file);
}
}发布于 2014-02-04 23:13:22
解链接函数通过完全根服务器路径删除文件,因此必须:
if ( file_exists(__DIR__ .'/'. $path . $fileNm .".jpg") ) {
unlink(__DIR__ .'/'. $path . $fileNm .".jpg");
} else {
die('File not exists!');
}art/images dir必须放在__DIR__中的位置。
https://stackoverflow.com/questions/21565504
复制相似问题