Home >Backend Development >PHP Tutorial >PHP 依据日期生成目录,检测目录存在,不存在自动建目录

PHP 依据日期生成目录,检测目录存在,不存在自动建目录

WBOY
WBOYOriginal
2016-06-13 10:38:181185browse

PHP 根据日期生成目录,检测目录存在,不存在自动建目录
$path=date("Y-m-d");  //获取当前时间


if(file_exists($path)) rmdir($path);  //检测变量中的文件夹是否存在,如果存在,删除

{
mkdir($path,0777);         //创建文件夹

}



echo $path;


Statement:
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