我想讓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