在PHP中,要使用rmdir()
函數刪除一個空目錄,您需要確保該目錄是空的
<?php
$directory = 'path/to/your/directory';
if (is_dir($directory) && rmdir($directory)) {
echo "Directory '$directory' has been removed successfully.";
} else {
echo "Failed to remove directory '$directory'. It may not be empty or does not exist.";
}
?>
請將path/to/your/directory
替換為您要刪除的目錄的實際路徑。如果目錄為空并且成功刪除,您將看到成功消息。否則,您將看到失敗消息。