Home > Article > Backend Development > php folder operations
Create Folder:
<?php //文件夹的创建 $newDir = "c:/php创建的文件夹/文件夹1/文件夹2"; if(!is_dir($newDir)){ if(!mkdir($newDir,0777,true)){ echo "创建文件夹失败"; }else{ echo "创建文件夹成功"; } }else{ echo "该文件夹已经存在"; } ?>
Delete Folder:
Note: Only empty folders can be deleted
<?php $rmDir = "c:/php创建的文件夹/文件夹1/文件夹2"; if(is_dir($rmDir)){ if(!rmdir($rmDir)){ echo "删除文件失败"; }else{ echo "删除文件夹成功"; } }else{ echo "不存在该文件夹"; } ?>
The above introduces the php folder operation, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.