本文實例講述了php實現刪除空目錄的方法。分享給大家供大家參考。具體分析如下:
php中可以通過rmdir()函數刪除一個空目錄
<?php
if (file_exists("/temp/test")) {
rmdir("/temp/test");
print("Directory removed.\n");
} else {
print("Directory does not exist.\n");
}
?>
上面的代碼第一次執行會返回
Directory removed.
第二次執行,由於目錄已經被刪除,會返回
Directory does not exist.
希望本文所述對大家的php程序設計有所幫助。