我想让codeigniter删除产品图片文件夹。Codeigniter删除目录及其内容
此外,我试图做的删除功能需要删除其所有内容,所以空或不,该文件夹被删除。我猜测,它会使用递归类型的删除...我根本不确定。
我已经尝试了以下功能删除:
function delete_directory($path)
{
$path=base_url().'products/thumb/';
$this->load->helper("file"); // load the helper
delete_files($path, true); // delete all files/folders
//rmdir($dirname);
if(rmdir($path)){
echo 'deleted';die;}
else{
echo 'not';die; }
return true;
}
但它总是返回不
见的警告在[文档页](http://ellislab.com/codeigniter/user-guide/helpers/file_helper.html)。你有权限删除这些文件吗?是否还有需要删除的子目录? (第二个参数传递为TRUE)。 –
嗨,如果你开发使用Ubuntu的检查Apache错误日志的错误。让我们知道它是什么显示 – Anish
检查http://stackoverflow.com/questions/14178731/removing-directory-using-codeigniter – ripa