php folder operations

WBOY
Release: 2016-08-08 09:24:59
Original
1551 people have browsed it

Create Folder:

<?php
//文件夹的创建
$newDir = "c:/php创建的文件夹/文件夹1/文件夹2";

if(!is_dir($newDir)){
	if(!mkdir($newDir,0777,true)){
		echo "创建文件夹失败";
	}else{
		echo "创建文件夹成功";
	}
}else{
	echo "该文件夹已经存在";
}
?>
Copy after login

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 "不存在该文件夹";
}
?>
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!