在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
替换为您要删除的目录的实际路径。如果目录为空并且成功删除,您将看到成功消息。否则,您将看到失败消息。