mkdir();函数
php创建文件夹和文件
///创建文件夹
function createdir($dir)
{
if(file_exists($dir) && is_dir($dir)){//如果存在这个文件并且这个文件是个目录就不动作
}
else{
mkdir($dir,0777);//否则就创造这个目录
}
}
file_exists();函数
file_exists -- 检查文件或目录是否存在
<?php
$filename = '/path/to/foo.txt';
if (file_exists($filename)) {
print "The file $filename exists";
} else {
print "The file $filename does not exist";
}
?>