[英]How can I dynamically make folder with today's date?
Is it possible and if it is, how can I create automatically folders that have the names of the current date? 是否可以,如果可以,如何自动创建具有当前日期名称的文件夹? I read that
mkdir()
will make me do the folders but how exactly to set the name of these folders so when I get information from some link the folder where i have to save this .txt
file to be created with for example - name: 'May-21-2014' (the current date). 我读到
mkdir()
将使我执行这些文件夹,但是如何精确设置这些文件夹的名称,因此当我从某个链接获取信息时,该文件夹必须保存要创建的.txt
文件,例如-name: “ 2014年5月21日”(当前日期)。
The first input of mkdir()
is the name . mkdir()
的第一个输入是name 。 Just put the string of the date into the value you pass it: 只需将日期字符串放入您传递的值中即可:
$name=date("l");
makdir($name//etc)
would result in a folder called Monday . 将导致一个名为Monday的文件夹。
Just format the date as you want it. 只需设置日期格式即可。
I would suggest folders to be yyyymmdd - eg 20140522
for today, it makes them sort nicely in ascending date order in a normal directory browser. 我建议文件夹为yyyymmdd-例如今天的
20140522
,它使它们在常规目录浏览器中按升序排列很好。
This would be: 这将是:
$name=date('Ymd');
when you make the folder name. 当您命名文件夹名称时。
mkdir(strftime("%B %d %Y, %X %Z",mktime(20,0,0,12,31,98)),0777,true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.